Appearance of UIKit

Posted by Daniel Vela on January 01, 2012 · 1 min read

* iOS 5 required

With appearance kit we can set the default attributes of any UIKit control. This attributes include tint color or background.

Changing background

NavBar

setBackgroundImage: forBarMetrics:  
    typedef enum{  
         UIBarMetricsDefault,  
         UIBarMetricsLandscapePhone,  
    } UIBarMetrics;  

UIBarButtons(back button)

setBackButtonBackgroundImage: forState: barMetrics:  

TabBar

UIImage* tabBarBackground = [UIImage imageNamed:"tabbar"];  
[[UITabBar appearance] setBackgroundImage:tabBarBackground];  
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:"selection"]];  


[<UIControl> appearance] "setAttributte"

With this invocation we can set the default attributes of any UIKit controls.

ishop