-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 4/19/11 1:07 PM, Rodrigo Zanatta Silva wrote: > I think this is simple, but i am have no idea. I create a upper class: > > #import "downClass.h" > @interface MyUpperClass : NSObject > > and in than I create > > downClass *test = [[downClass alloc] init]. > > > Than in my downClass is just a think like > @interface downClass: NSObject > > They are not Inheritance, so [super function] don't work. My problem is I > want to call a function in MyUpperClass and I am in downClass. It's a > instance function (like "- (void) function", not with +) so [MyUpperClass > function] will not work. > > The solution was use > [[NSNotificationCenter defaultCenter] addObserver:self > selector:@selector(function:) > name:@"observer" object:nil]; > to listen and > [[NSNotificationCenter defaultCenter] postNotificationName:@"observer" > object:nil]; > to call. > > Do this a correct way to do? There are another way better than this? For me, > this way cause problem because it's a little GOTO style and in debug make > things difficult.
I'm having a very hard time following what you are trying to do, in part because generic names in code (e.g. "upperClass" and "function") are hard to keep straight. You say you are trying to call an instance method. Do you mean you just want to do something like: MyUpperClass *upperClass = [[MyUpperClass alloc] init]; [upperClass function:someVariable]; ?? - -- Conrad Shultz Synthetiq Solutions www.synthetiqsolutions.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFNre4WaOlrz5+0JdURApttAKCKIifHWsYZNAPkjb6kxhwoHY5JBACggSPh OmZ/cESJXSqxfpgLi5j+gtY= =ZLvW -----END PGP SIGNATURE----- _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com