accessing settings from subviews
The iphone app I am creating has an array of commonly used settings. These settings will likely be changed frequently by the user and are pretty small, so I am using archiving to store a small array of objects. My top level view is a series of buttons (for UI design reasons) and not a tableview. These settings are used within one subview, and the user is permitted to change these settings in yet another subview. Right now, I am opening the archive file within each view that needs the settings (reading and/or writing). Should I be reading the settings archive once in the main app delegate, loading the data into a global array or is there some other approach I should be con开发者_如何学Csidering? My current approach is fast as the archive is small, but am doing way more reads than is necessary (read once to load labels on the buttons, again when in the view, and again to read/write on the view where the user can change their settings).
Thanks in advance for your guidance.
You could create a singleton object class to encapsulate, manage access, and potentially cache all these settings in memory for performance. It would be the Model/M in the Cocoa MVC paradigm.
精彩评论