ipad app skinning structure / methodology? - iphone

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.
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.
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.
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.

Related

How is styling of the UI for an IOS Apps done?

So with websites on the web we use HTML, CSS and Javascript.
What do we actually use to build the UI for an IOS App?
Is there a CSS/HTML/JS equivalent use for building IOS Apps?
What is the most common way use to design, style the UI of an IOS App?
The reason I ask is because I'm spending longer than expected learning core graphics and would like to move on with the book I'm studying from. I was under the impression core graphics was used for styling of apps and it was like an IOS equivalent of CSS.
Hoping someone could help clear things up thanks.
Regards
In many cases, images are used for styling in iOS.
For simple things like just changing background and text colors, UIView and its subclasses have direct accessors.
For most things, you won't need core graphics just for styling purposes. It would be easier to help you if we knew more concretely what you want to achieve, though.
The closest thing to a CSS equivalent is appearance proxies, which allow you to specify things like "all instances of UITextField should look have this font, colors and shadow when contained inside a NavigationController". You can override this for specific instances by just setting the desired values on the instance.

How to make iPhone app "skinnable"?

I was asked by a client to make a "skinnable" app and I don't really know what that means.
I googled like crazy and I didn't found a clear answer or an example.
If anyone has a clue about this, any tip would be appreciated.
Thanks.
Generally this means the app will allow the user to choose different looks for the UI, each of which will have a different color scheme, feel, etc.
What I actually did with my project. I decided to use multiple storyboards to give me greater control over the entire UI and UX of each theme. I programmatically link them all together via a master storyboard that links them all together. That's what I did, and it works very very well. Performance is great, while still maintaining high level of fine grain control over each theme. You can even keep your Header and Implementation files the same for individual view controllers, just so as you keep the names the same on the storyboard.
So for instance, one of my apps that I'm working on called Jam-mout (A music player) has multiple high quality themes. (Image attached). Each theme has it's own storyboard.
For iPhone apps, where the majority of the GUI design is provided by the operating system, you could do it by setting custom Navigation bar background images, custom button graphics, and different fonts/sizes/weights and whitespace. Make sure you're working with a designer who's familiar with the iPhone GUI (if you're not working closely with a designer this is going to be a nightmare).
I recently put together an app for a client who wanted a heavily customised GUI: http://itunes.apple.com/us/app/gogoparis/id428497937?mt=8. A 'skinnable' app would have several sets like this, so the user could choose between several different overall styles. (I hope your client has an enormous design budget!)
my post here should help you get started:
What is the recommended method of styling an iOS app?
if you need live theme changes, each theme in this example could post notifications when the user selects another theme (or skin) - then you can update either the theme instance itself.
alternatively, you can create identifiers for themes which are mapped (NSCFDictionary) to a central theme factory. an example identifier for a specific view for use with the theme factory could be a string MONImageSelectorTableCellThemeIdentifier.
an example manager/factory which handles all theme loading and vends references to themes:
#interface MONThemeManager : NSObject
//...
- (MONTheme *)themeForCurrentlySelectedSkinForViewWithIdentifier:(NSString *)identifier;
//...
#end
beyond that, it's hard to answer your question in more detail without knowing your requirements. the implementation of skinning an app can range from very simple to very very complex. good luck.
Already some good answer here, but I'd add that if you use a ui toolkit such as Three20
you can skin everything using CSS as you might for web pages.
I do realise this is an old post, but I thought I'd share my penny on the matter:)
To make any Cocoa app skinnable you need you think of 3 aspects of the app:
1) Uniformity: By this I mean that on all windows, views (including buttons, text inputs etc...) you want to have a 'standard' that will apply throughout the app. This is the first thing you need to look at. Although iOS and OS X alike already have 'themes' as to put it i.e. Apples default way of shading and laying things out, you can override these (refer to the individual view / window etc... documentation.
2) Performance: With skinning etc... performance is always an issue when it comes to writing your own drawRect etc... methods. The code apple have in place for the 'default' is already optimised, so you need to keep a close eye on the performance of the app whilst you are doing this. Good examples are: Do I use an image with a gradient, or do I use NSGradient? Both of which have performance issues when it comes to rendering them, but it's a question of which is the better of the two
3) userDefaults: This is generally the area where you'd be getting your 'skin settings' pulled from. userDefaults is basically where you store all of the information which you generally set in a preference pane.
If I were you I'd look into the class reference of it:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/
Furthermore, here's a nifty example of using userDefaults:
http://mobile.tutsplus.com/tutorials/iphone/nsuserdefaults_iphone-sdk/
Hope this helps!

How do you build or modify the user interface for an iPhone App?

What application is used for creating iPhone user interfaces?
Do you write code for layout, is there a css-esque system in place etc?
Or is it more like creating a winforms application where you drop in the elements in a visual designer?
Is it difficult to modify the appearing of an existing iPhone application, say to change the graphics used for buttons, and background colours on certain screens etc?
Additonal Info
The reason I ask is that I have a Blackberry application that I want converted to an iPhone application, and I need to know if I have to tell the developer translating it to build it in a certain way, as I need to be able to change the graphical appearance of this app.
I need to be able to change any background colours, logo, and the buttons used. Not sure if the iPhone uses images for "buttons" on the GUI?
You can either create UI completely in code, or use the Interface Builder visual tool to create pre-made UI objects, or any mix of the two. You can also modify an object loaded from an IB .xib file in your app's code.
To modify stuff created in code, you would need to edit the code and recompile. To modify objects created in interface builder, you would still need to rebuild the app (assuming stock tools and OS) with those new objects.
You can use Interface Builder, something like visual designer you said, to create xib (xml based) file for the UI. You can also create UI manually by code.
If you're more familiar to using css to layout UI elements, you can make a site for safari fitting the device's resolution, or put things into a html string and load it into a UIWebView.
You're able to modify the graphics, but you cannot put the app back to your phone unless you JBed you phone.

Display "custom" view (various images, various text). Should I use UIWebView?

First: No, none of the content should be loaded from the web. All content parts are shipped with the main bundle.
I have n images and mass of text (including lists). Instead of building all view parts programmatically in objective-c if was thinking of using an UIWebView and build "only" the HTML dynamically.
Does anything speaks against it?
How does UIWebView work with local content?
Links and resources welcome.
Thanks
I would not recommend using the WebView for building application UIs. It introduces many elements that may cripple the user experience. Well, it basically depends on the complexity of the UI.
I created an App UI in WebView myself, using JavaScript and all that advanced CSS animations/transforms that WebKit has to offer, but in the end it was not good for the consumer. My goal was to make the app skinnable, but if something goes wrong - for example in JS - the WebView is stuck, except you spend the time into building a WebView wrapper for your app that deals with this.
That said I, i don't know how complex your UI is going to be, but I would say using IB or building the UI in code with cocoa is still more efficient.
Regards, Erik
I've thought about using web views in these situations sometimes, but then decided against it. 99% of the time, it's better to design the screen in Interface Builder. That will be as fast as or faster than creating an HTML page, and will give you all the benefits of elements functioning as expected (text input for example) and the possibility of customizing things programmatically. But of course, in many scenarios a web view might be the way to go (in fact, several standard UI elements have underlying web views).

How can we use CSS for developing native iPhone app?

I am not developing any web app.
I am trying to use CSS in developing iPhone native app.
I am confused about where to include it and use it .
Whether to use it in the viewDidLoad or applicationDidFinishLaunching .
I am really getting tired of using the same UI look.
Can any body help me?
Thank You All.
The question you seem to be asking is "How can I make my UI skinnable" which is completely independent of any kind of technology for representing those choices.
If you want to built an HTML based application, then you can either have a UIWebView or develop a web-based application, both of which can be skinned with CSS.
If you want to make a UIKit application customisable (by changing background colours etc. and the like) then you'll have to roll your own way of doing that. CSS would be overkill for this purpose, and in any case, there is no 'standard' support for themeing applications. You might as well just write into the user defaults (probably via a settings bundle) what the user would prefer as a background colour etc. and then write a method to traverse your UIKit hierarchy to change the background colour as appropriate.
What are you trying to apply the CSS to? CSS is only going to be applicable to a UIWebView in general. For that, you'll load it in the HTML as you would for a website.
If this is still something that interests you there is a very early beta stage of CSSApply on github
Extremely lightweight skinning system for iOS. It allows you to load a
CSS file and skin UIView elements. The system also allows you to do
simple searches for subviews like jQuery with CSS selectors.