Reputation: 4747
What are some best practices of theming/skinning an iOS app?
Examples:
Links to good tutorials are a plus.
Upvotes: 3
Views: 5214
Reputation: 66
Old question, but still - if you're looking for best practices, then UIAppearance
is probably it.
However, if you're looking for a more powerful way to style your app (and create themes) - also have a look at InterfaCSS. InterfaCSS uses stylesheets inspired by CSS (and Less/Sass) that support a rich selector syntax and lets you use standard UIKit property names.
Upvotes: 2
Reputation: 63
You might want to check out Freestyle. It's built on Pixate, and styles your app with structured Sass. You can do as little as change the variable values to make a new theme, or extend and customize it via CSS or Sass.
Upvotes: 2
Reputation: 21
I know this may be late but I've stumbled upon a theme framework called Pixate. Pixate allows you to theme all your components using css. It's native meaning no web views and what not AND its fairly easy to implement in an existing project. Check it out.
Upvotes: 1
Reputation: 1007
You might take a look at NUI, which lets you modify the theme/skin of an app very easily, and save that theme for other apps, too.
For example, if you wanted to use a custom image for the background of all of your UIViews, you would just put the following in the NUI style sheet:
ViewBackgroundImage String MyImage.png
NUI supports styling for UITableViews and UIButtons, too (as mentioned in your other examples).
Upvotes: 2
Reputation: 3459
I can suggest that:
the init function should have one parameter to plist file that contains the assets(images) that will be needed for your class to work properly. it should be a plist file that contains a dictionary for a predefined keys.
I hope that helps.
Upvotes: 2
Reputation: 10808
You can create a protocol that defines methods to return theme-specific colors, images, etc. All classes that conform to this protocol have to implement these methods.
@protocol MyCustomThemes <NSObject>
-(UIFont*)writingAreaFont;
-(UIColor*)dataCellLabelColor;
-(UIImage*)dataCellBackgroundImage;
@end
Upvotes: 6