b2cloud

12th October 2011

Tint Colours in iOS5

News By 5 years ago

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:

  • UIBarButtonItem
  • UINavigationBar
  • UIProgressView
  • UISearchBar
  • UISegmentedControl
  • UISlider
  • UISwitch
  • UITabBar
  • UITabBarItem
  • UIToolbar
Recommended Posts

7 Tips From Apple's iOS Human Interface Guidelines

Post by 5 years ago

With Apple’s iOS Human Interface Guidelines now available on the iBook Store, here some important tips to keep in mind when designing an app.

Got an idea?

We help entrepreneurs, organizations and established brands from around
the country bring ideas to life. We would love to hear from you!