If you have worked with some of the basic iOS controls previously you have probably pulled hair trying to figure out how to change the colours around. Most notably the UISwitch – currently developers only have access to the standard blue version, and it doesn’t help when the orange ‘Airplane Mode’ switch teases you in the Settings app.
This is all going to change in iOS5, with the introduction of tint colours among many of the standard interface controls. UISliders will also be included in this update, allowing tint customisation for the minimum and maximum sides of the bar, as well as the draggable notch.
[mySlider setMinimumTrackTintColor:[UIColor greenColor]];
Another current hassle I have faced whilst developing an iPhone app is creating identical looking controls/navigation bars throughout my entire app. Generally I will either subclass the original class or create a category for it, which does work, but in iOS5 it will be made much easier with the ‘Appearance proxy’, a static method associated with most controls that can be used to change the appearance for all future instances of this control. For example, if every slider needed to have a green tinted bar, you may call:
[[UISlider appearance] setMinimumTrackTintColor:[UIColor greenColor]];
This applies to UINavigationBars too, making it easy to set a custom bar image for every instance of your bars, no more categories or subclassing 🙂
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@”barImage”] forBarMetrics:UIBarMetricsDefault];
Some of the controls getting updated: