Access to variable applications: static, how is Java?

I have an instance variable in the view controller that I would like to share with the whole program. I'm not quite sure how to do this. Can I just declare it as a static instance variable and then access it through properties like ViewControllerClass.instancevariable?

Thank!

+3
source share
1 answer

In response to your comment related to the question:

If you have an instance variable in object X, any other object that has a reference to X can access this variable in the usual way:

[objectX myClassAInstanceVariable];
// Or, if declared with @property
objectX.myClassAInstanceVariable;

X, . .


"" Objective-C , (, Java).

Objective-C " ", ​​; , mathk : Objective-C . , , .

, , . , Objective-C - "", , , . setter getter.


, , - " ", , *. :

[NSApp delegate];

NSApp - NSApplication, .


* , , .

+2

All Articles