|
|
|
|
#1 |
|
So about Singeltons and Global ivars.
So until the other day I thought my objects instance variables were "Global Variables". My thinking was that if I had 2 or more Methods that needed to access the same variable, I would declare them "Globally" and instantiate them. If not I would declare them locally within the Method for temporary use. (like I learned in my Pascal class regarding the Scope or variables).
- Are object instance variables also know as global variables for that object? I seem to use them in that capacity and they function that way. But are they know as Global Variables too? I have not learned how to use Singletons yet but I guess they store information "Globally" in my root controller which I can use to pass information to my different objects? - Are there any good tutorials out there to learn how to use Singletons? I did google it but sometimes folks here have good resources too. This is my weekend project to learn. Thanks!
__________________
I know more than yesterday. Lars |
|
|
|
0
|
|
|
#2 | |
|
Quote:
For more put the following into Google: using singleton cocoa Instance variables are global to an object, yes. It's that scope thing you mentioned. Sometimes you'll find a variable defined above the @interface. Those variables are global but typically considered class variables. For some more check out Objective-C Variable Scope and Storage Class.
__________________
My App: CameraTime - Time lapse photography for novice and advanced users.
|
||
|
|
0
|
|
|
#3 |
|
Cool, thanks for the links. I will read up on them.
So instance variables are also know as global variables, to that object. Thanks for the clarification.
__________________
I know more than yesterday. Lars |
|
|
|
0
|
|
|
#4 |
|
Yes, but nobody refers to them as global to the object because global indicates more than that. People refer to them as instance variables, or ivars in short form.
__________________
My App: CameraTime - Time lapse photography for novice and advanced users.
|
|
|
|
0
|
|
|
#5 |
|
Cool. Thank you.
__________________
I know more than yesterday. Lars |
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 01:22 AM.







Hybrid Mode
