开发者

I want to store a bunch of data in an array, for use in various different classes. How?

So i've tried and tried at this and for the most part it's worked, but with it's problems. I need to start again though with this. So can somebody explain the best way that I can have an array in m开发者_如何学编程y app which allows other classes to access it, edit it, delete items from it and add new items?


You can probably have it declared as an instance variable in appDelegate so it can be easily accessed by other classes

YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate];
//and then access the variable by appDelegate.variable


If u declare array in the appDelegate you can access the array in all other classes using main appDelegate instance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜