views:

58

answers:

4

I am fairly new to Objective-C and have been doing some iPhone programming.

Is it possible to look up the value of a variable in a different class?

Basically what I am doing is running a function that exists in my application delegate from a view controller, but the application delegate needs to use a variable stored in the view controller from which the application delegate function was called. Does it make sense?

+1  A: 

You can always pass the variable into the function which needs it. Or you can make a getter for it

OTisler
A: 

Fixed the problem by simply passing the variable to the app delegate and doing it that way.

A: 

It sounds to me that you need to expose that variable as a property.

MattjDrake
A: 

You can create a singleton and store your data and have it available all over the place.

fernyb