Re: Calling method in brand new view to set a variable?
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