Reputation: 2539
I am developing an app in IOS 7 and I am setting the custom images for tabbar icons. Here is my code:
UIImage *musicImage = [UIImage imageNamed:@"monitor"];
UIImage *musicImageSel = [UIImage imageNamed:@"11"];
musicImage = [musicImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
musicImageSel = [musicImageSel imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Notifications" image:musicImage selectedImage:musicImageSel];
My problem is that when I select any tab in the tabbar the image just appears to enlarge.
I am attaching screen shot for more clarification. I just want the image to be in the tabbar. And also both the images are of 50X50px in size.
Upvotes: 0
Views: 365
Reputation: 1773
Maybe try manipulating imageInset property. For me (5,0,-5,0)
were ok - but I didn't use titleLabel
self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Notifications" image:musicImage selectedImage:musicImageSel];
self.tabBarItem.imageInsets = UIEdgeInsetsMake(5, 0, -5,0);
Upvotes: 1