• 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: Calling method in brand new view to set a variable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling method in brand new view to set a variable?


  • Subject: Re: Calling method in brand new view to set a variable?
  • From: Graham Cox <email@hidden>
  • Date: Wed, 21 Oct 2009 15:51:53 +1100


On 21/10/2009, at 3:39 PM, Eric E. Dolecki wrote:

I am calling up a view from it's nib, and immediately calling a method in
that view controller class to set a variable. I can't access the newly set
variable in viewDidLoad, so I have a timer of 100ms inside the viewDidLoad
that actually uses the variable that is set (it's available by then).
Is there a better way (callback method) that I should use instead that would
be foolproof and not based on a NSTimer being long enough to properly
access? Or should I store the variable in my model class and just use a
getter at that point instead? It's a little easier to keep it in the view
using it, but if that's the way to do it, so be it.


This sounds what -awakeFromNib is for (see NSNibAwaking protocol) . Is there some reason you can't use that?

--Graham


_______________________________________________

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


References: 
 >Calling method in brand new view to set a variable? (From: "Eric E. Dolecki" <email@hidden>)

  • Prev by Date: Re: Questions about Nib Object Retention
  • Next by Date: Re: How to run a panel that customizes a new NSDocument
  • Previous by thread: Calling method in brand new view to set a variable?
  • Next by thread: Magic Mouse and NSTouch
  • Index(es):
    • Date
    • Thread