I’m finding a good design pattern to skin an app. Suppose that… you ‘ve got several different classes that need different fonts, with different sizes.
My original approach was to build an UIFont category, and place a bunch of methods… say…
+ (UIFont*)myTabBarFont;
I was just wondering if anyone has a more elegant solution.
Thank you!
(BTW i need to maintain compatibility with iOS 4, i can’t rely 100% on the new Appearance api).
EDITED:
I’ll answer this question myself. What i was actually looking for was an elegant approach to skin components app-wide.
One of the options would be to use Inversion of Control, and instead of fetching, everywhere, specific fonts and colors, you could simply create an AppearanceManager, and pass on the control & context in which you wish to skin it. For instance:
[[AppearanceManager sharedInstance] skinComponent:something container:somethingElse];
That way you can maintain all of your styles in a single class. Of course, AppearanceManager class would rely on reflection to fetch the attributes to apply.
It´d be great to hear if anyone has implemented a better approach.
Thanks!
I think you should store all your settings into separate file and call them manually depending on skin name or skin id. If you use plist file then you can load it into an array with one command and the elements of this array will mean boxes of values for each skin separately