UITabbar in Xcode 6

若如初见. 提交于 2019-12-06 11:18:59

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!