I want to add NSArray with NSString values in it. I’m almost sure that I can use #define for it, but I don’t understand how to access and initialize that declared variables.
For example i have:
#define my_definition 0;
And i know how to access this 0 value. But how about NSString inside NSArray?
I have a definitions.h file. In there i have access from any my class.
Whoa… what are you trying to do here?
#defineis a preprocessor macro. The preprocessor knows nothing about Objective-C (or C for that matter… it’s just a glorified text replacement engine), and Objective-C knows nothing about the preprocessor.You almost certainly don’t want a
#definefor anything other than maybe numeric values (e.g.ints) or anNSString. (In practice, you will usually seeextern NSString * ...in lieu of#definefor a variety of reasons, too.)If you need access to a particular
NSArrayin an object, you can create an ivar that you populate in-initor the like. If other classes need access to the array, make it a@propertyor just declare a (public) method.Maybe I’m misunderstanding what you are trying to do?