Ios Xcode 6中的UITabbar
我在iPhone4、4s、5、5S中有一个带有4个标签的UITabbarController,它可以很好地处理标签栏项目图像 但在iphone6和iphone6plus中,它看起来是有线的。 iphone6和iphone6plus是否需要放置不同的图像? 如何设置此图像 在iphone6中 还有,iphone6plusIos Xcode 6中的UITabbar,ios,objective-c,uibarbuttonitem,uitabbar,xcode6.1,Ios,Objective C,Uibarbuttonitem,Uitabbar,Xcode6.1,我在iPhone4、4s、5、5S中有一个带有4个标签的UITabbarController,它可以很好地处理标签栏项目图像 但在iphone6和iphone6plus中,它看起来是有线的。 iphone6和iphone6plus是否需要放置不同的图像? 如何设置此图像 在iphone6中 还有,iphone6plus 您需要为iPhone 6和iPhone 6 Plus制作新的尺寸 事实上,他们有了新的分辨率:iPhone6 1334×750像素和iPhone6 Plus 1920×1080像
您需要为iPhone 6和iPhone 6 Plus制作新的尺寸 事实上,他们有了新的分辨率:iPhone6 1334×750像素和iPhone6 Plus 1920×1080像素
此外,如果您使用的是自动布局,则需要更新约束。我遇到了同样的问题。这里的问题不仅在于分辨率不同,而且事实上iphone 6和iphone 6 plus的边界更宽。通过在所有不同类型的手机上运行模拟器,我发现:
Tab bar Bounds
iPhone 6 plus: 414 x 49
iPhone 6: 375 x 49
iPhone 5: 320 x 49
iPhone 4 320 x 49
这意味着您必须为iphone 6和6 plus使用不同的背景图像。
我不确定这是否是最有效的方法,但它为我解决了这个问题:
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"];
}
希望有帮助 你是说我需要为iPhone 6添加单独的故事板?没有必要,你应该查看这篇文章:它解释了如何在iPhone 6/6plus上实现图像大小。你有这个问题的解决方案吗?请分享。经过数小时的搜索,这解决了我的问题!谢谢