I have an application which allows customizing attributes such as background color, buttons, text (ie, titles), etc. In its current incarnation, viewDidLoad
set the appropriate property on a UI widget by calling into a LookAndFeel
class. LookAndFeel
reads the user preferences.
Should each view perform a call into LookAndFeel
, or should the Application fetch an attribute once and use the fetched value in all views? Is it OK to call getTitleColor
once, hold it in the app delegate, and use it in every view?
That depends on how expensive your getTitleColor
method is. If it's expensive, it should definitely be cached.
(Note: reading from a file or from NSUserDefaults
could be considered expensive)