All,
I have numerous arrays in the top of my .m file :
@interface ViewController ()
@property NSArray *allLogos;
@property NSArray *allcontent;
@property NSArray *allpostode;
@property NSArray *allname;
@property NSArray *alladdress;
@property NSArray *alladdress2;
@property NSArray *alllat;
@property NSArray *alllong;
@property NSArray *alllocationsID;
@property NSArray *alllocationsCity;
I need these as global arrays, so all the methods can see these. I have completely forgot how to make sure these NSArrays can be seen in all methods in the .m file. I need to do this because methods update these Arrays and then tableViews and PickerViews need to use them for .count etc. thanks
在这里,您可以找到如何在Objective-C中创建Singleton类:[Objective-c singleton] :( 我的Objective-C Singleton应该是什么样?
If you want access following arrays in all class then don't make property in .m class.declaration in .m if you want to make private.
@interface ViewController : UIViewController
@property NSArray *allLogos;
@property NSArray *allcontent;
@property NSArray *allpostode;
@property NSArray *allname;
@property NSArray *alladdress;
@property NSArray *alladdress2;
@property NSArray *alllat;
@property NSArray *alllong;
@property NSArray *alllocationsID;
@property NSArray *alllocationsCity;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.