I have UITabbarController
with 4 tabs in iPhone 4, 4s, 5, 5S it is woking fine with tabbar item image
But in iPhone 6 and iPhone 6 plus is looking wired.
Is it need to put different images for both iPhone 6 and iPhone 6 plus ?
How can I set this images.
in iphone 6
And, iPhone 6 Plus
I ran into this same issue. The problem here is not only the different resolution, but the fact that the size of the bounds is actually wider for iphone 6 and iphone 6 plus. By running the simulator on all different phone types I found the following:
Tab bar Bounds
iPhone 6 plus: 414 x 49
iPhone 6: 375 x 49
iPhone 5: 320 x 49
iPhone 4 320 x 49
This means that you must use different background images for iphone 6 and 6 plus.
I'm not sure if this is the most efficient way to do this, but it fixed it for me:
UITabBarController *tabBarController = (UITabBarController *) self.parentViewController;
UITabBar *tabBar = tabBarController.tabBar;
if ([[UIScreen mainScreen] bounds].size.height > 700) {
tabBar.selectionIndicatorImage = [UIImage imageNamed:@"tabbar-selected6Plus"];
} else if ([[UIScreen mainScreen] bounds].size.height > 600) {
tabBar.selectionIndicatorImage = [UIImage imageNamed:@"tabbar-selected6"];
} else {
tabBar.selectionIndicatorImage = [UIImage imageNamed:@"tabbar-selected"];
}
Hope that helps!
You need to make new size for iPhone 6 and iPhone 6 Plus.
Indeed they have new resolution: iPhone 6 (1334-by-750-pixel) and the iPhone 6 Plus (1920-by-1080-pixel).
Moreover if you are using auto-Layout you need to update your constraints.