Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RPGamerL99

macrumors newbie
Original poster
Mar 10, 2008
18
0
Please tell me there is a way to make a variable open for any class in the program to use because i can not figure out how to get the drawView class to recognize variables i declared in App Delegate. it is because i am initiating some variables in applicationDidFinishLaunching. (OpenGL ES template under new project).
 

firewood

macrumors G3
Jul 29, 2003
8,141
1,384
Silicon Valley
The OP asked about global variables, not about OO design and MVC patterns.

You can use standard C conventions for declaring, instantiating and using global variables outside your Cocoa object declarations. Read any complete generic C tutorial. Be aware of the pitfalls of using global variables in large or reusable code projects.

.
 

ayasin

macrumors 6502
Jun 26, 2008
318
0
You can get at your delegate by using [[UIApplication sharedInstance] delegate] and casting it to your delegate, in the case you're describing you don't need global variables.
 

RPGamerL99

macrumors newbie
Original poster
Mar 10, 2008
18
0
I'm not sure how to use [[UIApplication sharedInstance] delegate] properly. Is there online documentation available?
 

RPGamerL99

macrumors newbie
Original poster
Mar 10, 2008
18
0
I decided to access those variables with methods, but for other classes to access those methods, they have to be in protocols right? Can someone show me how to implement a protocol or point me in the right direction?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.