Reputation: 153
I created a UITabBarController
with storyboard for iOS5. I don't have the UITabBar
declared in my ViewController and I can't set background image for tab bar.
UIImage *tabBackground = [[UIImage imageNamed:@"tabBarBackground.jpg"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
// Set background for all UITabBars
[[UITabBar appearance] setBackgroundImage:tabBackground];
// Set background for only this UITabBar
[[tabBarController tabBar] setBackgroundImage:tabBackground];
Upvotes: 0
Views: 348
Reputation: 12832
You'll need to designate tabBarController
as an IBOutlet property
@property (nonatomic, strong) IBOutlet UITabBarController *tabBarController;
Then wire them up in the Connections inspector in Interface Builder, and you'll be able to use your code as shown.
Upvotes: 1