• 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: iPhone: Accessing variable from another view controller
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iPhone: Accessing variable from another view controller


  • Subject: Re: iPhone: Accessing variable from another view controller
  • From: "Eric E. Dolecki" <email@hidden>
  • Date: Fri, 21 Aug 2009 09:53:43 -0400

Okay - I moved my method into my app delegate and I can access it like
that.
However, how does one access class properties from one class to another (not
using app delegate) - without making an instance of it - or do you need to
do that? Looking for a singleton implementation.

On Fri, Aug 21, 2009 at 9:39 AM, Eric E. Dolecki <email@hidden> wrote:

> I had @synthesize too.
> In my 1st tab is the FirstViewController - when I run the app it says
> "optionally move this view into a sep nib file..."
>
> 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.
>
>
> On Fri, Aug 21, 2009 at 9:35 AM, Luke the Hiesterman <email@hidden>wrote:
>
>> You probably need to @synthesize the property in FirstViewController's
>> @implementation. If it compiles but just doesn't work, log the output of
>> this line:
>>
>> NSLog(@"class of app delegate: %@", [fvDelegate class]);
>>
>> ....because it seems very odd to me that your app delegate is also a view
>> controller - that's not how things generally work, (and probably not a good
>> design idea).
>>
>> Luke
>>
>>
>> On Aug 21, 2009, at 6:28 AM, email@hidden wrote:
>>
>>  i caught that after sending. it still does not work
>>>
>>> ----------
>>> Sent from the Verizon network using Mobile Email
>>>
>>> ------Original Message------
>>> From: Luke the Hiesterman <email@hidden>
>>> To: "Eric E. Dolecki" <email@hidden>
>>> Cc: "cocoa-dev" <email@hidden>
>>> Date: Fri, Aug 21, 6:22 AM -0700
>>> Subject: Re: iPhone: Accessing variable from another view controller
>>>
>>>
>>> On Aug 21, 2009, at 5:54 AM, Eric E. Dolecki wrote:
>>>
>>>  FirstViewController *fvDelegate = (FirstViewController *)
>>>> [[UIApplication
>>>> sharedApplication] delegate];
>>>>
>>>> BOOL online = FirstViewController.availableNetwork;
>>>>
>>>
>>> This should be fvDelegate.availableNetwork. You access the property on
>>> the instance, not the class.
>>>
>>> Luke
>>>
>>>
>>
>
>
> --
> http://ericd.net
> Interactive design and development
>



--
http://ericd.net
Interactive design and development
_______________________________________________

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: iPhone: Accessing variable from another view controller
      • From: Luke the Hiesterman <email@hidden>
References: 
 >Re: iPhone: Accessing variable from another view controller (From: "email@hidden" <email@hidden>)
 >Re: iPhone: Accessing variable from another view controller (From: Luke the Hiesterman <email@hidden>)
 >Re: iPhone: Accessing variable from another view controller (From: "Eric E. Dolecki" <email@hidden>)

  • Prev by Date: Re: iPhone: Accessing variable from another view controller
  • Next by Date: Re: iPhone: Accessing variable from another view controller
  • Previous by thread: Re: iPhone: Accessing variable from another view controller
  • Next by thread: Re: iPhone: Accessing variable from another view controller
  • Index(es):
    • Date
    • Thread