How call upper layer function
How call upper layer function
- Subject: How call upper layer function
- From: Rodrigo Zanatta Silva <email@hidden>
- Date: Tue, 19 Apr 2011 17:07:08 -0300
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.
_______________________________________________
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