Possible Duplicate:
How to use global variables in Objective-C?
In my Login.m file, I have
NSString *userName = txtUsername.text; // this is getting the text from the username text field and storing it in userName
The problem is that I need to access the variable userName from different classes also and so I need to declare it as a global variable. What is the best way of doing this ?
One option is to make it an instance variable in the Application Delegate. The Application Delegate can easily be accessed from other class instances. This is somewhat better as global variables are not a good design.