开发者

iOS: How to Create and Maintain an Attribute that Affects Several Different Classes?

My app is constructed with several UIViewControllers based on a UINavigationController. There are some attributes that become relevant in several different classes; for example the device (iPhone/iPad) or the device selected language (english/french/Chinese/etc...).

I assume this should be quite trivial, but I actually don't know how to do this (or how this feature is called in XCode): How can I create an a开发者_如何转开发ttribute that will serve all classes?

Should it be located in the AppDelegate file or someplace else?


I think you should create a singleton, so you could share data among your UIViewControllers. Here's a nice tutorial:

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜