• 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 10:34:29 -0300

Wow.. You understand. I tried my best but, but wasn't enough. :P

You give-me a great idea
-> LevelDown *test = [[LevelDown alloc] initWithLevelUp: self];

Ok, use global variable is a way to do, but people aways say "global
variable" is a bad idea.

I understand objective-c. I only didn't have an idea like this. It's so
simple. (So stupid I have to say, why I start this post if it is so
simple)... Only use self... This make sense now. Like I say, I only need an
idea :P

Thanks all for help.

Conrad Shultz: Sorry I only want write the idea of my problem about 2 class,
the memory manager wasn't my  deal. Thanks for your time and knowledge :P

2011/4/19 Quincey Morris <email@hidden>

> On Apr 19, 2011, at 15:03, Michael Dautermann wrote:
>
> > How is LevelUp instantiated?  Is it part of the XIB that also contains
> LevelDown?
> >
> > If so, you could declare "IBOutlet id levelUpObject" in your LevelDown
> view and connect it to LevelUp.
> >
> > If LevelUp and LevelDown are not part of the same XIB or LevelUp isn't
> instantiated by something else accessible to LevelDown (e.g. the application
> delegate or some controller), then notifications may be the best way to go.
>
> Er, let's not go off the rails here. The OP simply wants a LevelDown object
> to send a message to a LevelUp object. That requires levelDown to have a
> reference to levelUp, one simple way to do that is to give it the reference:
>
>        LevelDown *test = [[LevelDown alloc] initWithLevelUp: self];
>
> However, the real problem is one of these:
>
> -- The OP isn't sufficiently knowledgeable of Objective-C to customize
> initializers like this yet.
>
> -- The OP hasn't considered the communication between LevelDown and LevelUp
> as the design problem it really is.
>
> -- The OP isn't familiar enough with Cocoa design patterns to consider the
> various alternative designs.
>
> It's possible that the correct answer is that the LevelUp pointer should be
> a global variable, or that it should be held by the application delegate, or
> that the LevelDown really should keep a reference to the LevelUp as an
> instance variable whose value is passed in the initializer. But we don't
> know, because the question is too vague.
_______________________________________________

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: Rodrigo Zanatta Silva <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>)

  • Prev by Date: Re: ArrayController vs Pop-up button vs Transformer -- three way tag team death match!
  • Next by Date: scaling a transformed view
  • Previous by thread: Re: How call upper layer function
  • Next by thread: Re: How call upper layer function
  • Index(es):
    • Date
    • Thread