Re: iPhone: Accessing variable from another view controller
Re: iPhone: Accessing variable from another view controller
- Subject: Re: iPhone: Accessing variable from another view controller
- From: Luke the Hiesterman <email@hidden>
- Date: Fri, 21 Aug 2009 06:55:19 -0700
On Aug 21, 2009, at 6:39 AM, Eric E. Dolecki wrote:
When I trace out the class, it is indeed the app delegate and NOT
the firstViewController. That's pretty strange. I was expecting to
get at the actual FirstViewController class.
What made you think that [[UIApplication sharedApplication] delegate];
would return a view controller rather than the app delegate? If you
need a reference to this view controller perhaps it would be a good
idea to declare a firstViewController property in your appDelegate and
then you could do something like this:
[[UIApplication sharedApplication]
delegate].firstViewController.availableNetwork;
While on that note, it's a actually probably even better of an idea to
have the availableNetwork property exist in your appDelegate, since
this is sort of generic application state property - it's not
inherently the property of an individual view controller. So, then
you'd end up with:
[[UIApplication sharedApplication] delegate].availableNetwork;
Luke
_______________________________________________
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