user1625435
user1625435

Reputation: 153

UITabBarController image iOS 5

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

Answers (1)

Andy Obusek
Andy Obusek

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.

enter image description here

Upvotes: 1

Related Questions