1

I am using UITabBarController and want to add image to it, a whole image to tab bar, not to any tab item. Is it possible, can anyone guide. Thanks in advance.

iPhone Programmatically
  • 1,211
  • 2
  • 22
  • 54

2 Answers2

2

Try this. May be it help

 UIImage *tabBackground = [[UIImage imageNamed:@"Your Image"] 
                          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];
Wolverine
  • 4,264
  • 1
  • 27
  • 49
0

If you are using iOS 5 or greater you can use setBackgroundImage:

UITabBar *yourtabBar = [yourtabController tabBar];

[yourtabBar setBackgroundImage:[UIImage imageNamed:@"tabbar.jpg"]];
Midhun MP
  • 103,496
  • 31
  • 153
  • 200