The way to declare a global is to declare it outside of any @interface...@end block, and to define in outside of any @implementation...@end block, as in:
Code:
//this code goes under some .h file (it doesn't matter which one)
extern NSMutableArray *globalArray;
@interface (of some class - it doesn't matter which one)
...
@end
Then define globalArray as in:
Code:
NSMutableArray *globalArray;
@implementation (any, it doesn't matter which one)
...
@end
And then, somewhere where you are sure it will only be executed once:
Code:
globalArray = (some alloc-type of NSMutable Array creation method, retaining)
Now you have a singleton NSMutableArray you can access from anywhere. Just don't ever release it. It's memory will be reclaimed automatically when your app closes.
Robert Scott
Ypsilanti, Michigan