Syed e Hussaini Syed e Hussaini - 5 days ago 5
Objective-C Question

Tabbar Background image is not perfectly placing

I have a

UITabBarController
i want to change its background image when i change the background image to using this code

self.tabBar setBackgroundImage:[UIImage imagenamed:@"texture.jpg"]];


Instead of changing the
tabBar
background image it changes the whole screens background image.

Change Image of Red Rectangular Box Below
Image2 Screenshot

Answer

Use this code in your AppDelegate after setting tabBarController as rootViewController

UITabBarItem *item = [self.tabBarController.tabBar.items objectAtIndex:0];
item.image = [UIImage imageNamed:@"YourDeselectImage.png"];
item.selectedImage = [UIImage imageNamed:@"YourSelectImage.png"];