Set the image using method setBackgroundImage:forBarMetrics.
[[UINavigationBarappearance] setBackgroundImage: portrait forBarMetrics:UIBarMetricsDefault]; [[UINavigationBarappearance] setBackgroundImage: landscape forBarMetrics:UIBarMetricsLandscapePhone];
Create resizable images
UIImage *portrait = [[UIImageimageNamed:@”image1″]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
UIImage *landscape = [[UIImage imageNamed:@”image2″]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0,0)];
Set the attributes of Naviagtion Bar (to set the title font, color, shadowoffset)
[[UINavigationBarappearance] setTitleTextAttributes: [NSDictionarydictionaryWithObjectsAndKeys: [UIColorcolorWithRed:255.0/255.0green:255.0/255.0blue:255.0/255.0alpha:1.0], UITextAttributeTextColor, [UIColorcolorWithRed:0.0green:0.0blue:0.0alpha:0.8], UITextAttributeTextShadowColor, [NSValuevalueWithUIOffset:UIOffsetMake(0, -1)], UITextAttributeTextShadowOffset, [UIFontfontWithName:@"Arial-Bold"size:0.0], UITextAttributeFont, nil]];
Similary, we can set the background image of UISegmentedControl and UITabBar, UIBarButtonItem etc.