• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How call upper layer function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How call upper layer function


  • Subject: Re: How call upper layer function
  • From: Rodrigo Zanatta Silva <email@hidden>
  • Date: Wed, 20 Apr 2011 15:34:50 -0300

Now i remember the problem about this solution.

To this work, LevelUp have to include LevelDown
and LevelDown have to include LevelUp. (This is a cyclic include and will
fail)

To solve this, I read in a book to use the @class. I do that.
LevelUp have a #import "levelDown.h"
and LevelDown have a @class LevelUp

Now the problem is that any function call cause problem because the compiler
don't found it.
In code is thing like this:
//This is the "LevelUp.h"
*#include "LevelDown.h"*   //IF I use *@class*, it will have the same
problem
@interface LevelUp : UIViewController {
    LevelDown *levelDown;
}
-(void) doSomething;
@end

//LeveUp.h only call in a correct place the line:
// LevelDown *test = [[LevelDown alloc] initWithLevelUp: self];

//So, the "LevelDown.h" is
*@class LevelUp;*
@interface LevelDown : UIViewController  {
}
- (id)initWithLevelUp: (LevelUp *)levelUp;
@end

//Finally in "LevelDown.m" i have
#import "LevelDown.h"

@implementation *LevelDown*
 - (id)initWithLevelUp: (LevelUp *)levelUp; {
     self = [super init];
     LevelUp* myLevelUp = levelUp;
     [myLevelUp doSomething];   //Everything work, but this will give-me a
problem
     return self;
}
@end

In the line that have problem, the XCode will show

   - warning: no '-doSomething' method found
   - warning: Semantic Issue: Method '-doSomething'' not found (return type
   defaults to 'id')

But the method is correct. What I am doing wrong?

My problem is a little more complex than a simple line.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How call upper layer function
      • From: Quincey Morris <email@hidden>
    • Re: How call upper layer function
      • From: Conrad Shultz <email@hidden>
References: 
 >How call upper layer function (From: Rodrigo Zanatta Silva <email@hidden>)
 >Re: How call upper layer function (From: Conrad Shultz <email@hidden>)
 >Re: How call upper layer function (From: Rodrigo Zanatta Silva <email@hidden>)
 >Re: How call upper layer function (From: Michael Dautermann <email@hidden>)
 >Re: How call upper layer function (From: Quincey Morris <email@hidden>)
 >Re: How call upper layer function (From: Rodrigo Zanatta Silva <email@hidden>)

  • Prev by Date: Re: iOS rotate to interface orientation problem
  • Next by Date: Re: NSArrayController & image in column
  • Previous by thread: Re: How call upper layer function
  • Next by thread: Re: How call upper layer function
  • Index(es):
    • Date
    • Thread