how and where do I initialize an global NSMutableArray in Xcode 5

后端 未结 4 1897
渐次进展
渐次进展 2020-12-19 10:32

I am trying to initialize a global NSMutableArray that I can add integers to later. I just need to know how and where I should initialize my array so that it can be accessed

4条回答
  •  伪装坚强ぢ
    2020-12-19 11:27

    Creating a Singleton class is the better option for you. In this singleton class, you can initialize the array. Later, you can access this array from any class by using this singleton class. A great benefit is you dont need to initialize the class object everytime. You can access the array using a sharedObject.

    Below is a tutorial for Singletons in objective C

    http://www.galloway.me.uk/tutorials/singleton-classes/

提交回复
热议问题