开发者

ipad app skinning structure / methodology?

I'd like to offer my app users a couple of different skins to use for the app, a default black skin and then say a white skin. Maybe allow them to set fonts and / or font color site wide for headers or whatever.

What would be the best approach to do this? Obviously I don't want 开发者_如何学运维this to affect the speed of my application.


You basically have 3 options.

  1. HTML5 + CSS in UIWebView
    Depending on your needs, the most flexible way would be to provide part of the user interface via UIWebView as HTML5 and CSS, and let the users (or theme makers) create different CSS based styles. This is what most applications do; IM+ or Colloquy for instance.

  2. Modifying the native controls by subclassing them
    Apple might reject apps that modify the native controls and views. So that is not a secure option if you want to submit your app to the App Store.

  3. Create your own UIView subclasses and implement their behavior
    Option three would be to draw your own controls using subclasses of UIView, but that might be more work than it's worth. You find this in many games on iOS.


For storing and accessing properties like colors and other parameters that make up the user interface, I'd suggest using something simple.

In some of my apps I use a JSON file (or alternatively XML - but that's more work to parse). There is TouchJSON (github.com/schwa/TouchJSON) which does an excellent job in simply converting a file into an NSDictionary, which is easily accessible. You could, for instance, store colors and font names and sizes in such a file and read one of them at launch time.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜