• 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
How call upper layer function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: How call upper layer function
      • From: Conrad Shultz <email@hidden>
  • Prev by Date: Re: UIView/NSView doesn't display changing data in real time
  • Next by Date: Re: How call upper layer function
  • Previous by thread: Re: warning: cast from pointer to integer of different size
  • Next by thread: Re: How call upper layer function
  • Index(es):
    • Date
    • Thread