【问题标题】:How to support different tab bar icon sizes in iOS 7 and iOS 6?如何在 iOS 7 和 iOS 6 中支持不同的标签栏图标大小?
【发布时间】:2013-11-04 00:40:21
【问题描述】:

在 iOS 7 中,Apple 增加了标签栏图标的标准尺寸。如果标签栏图标设置在 storyboard 中,如何同时支持 iOS 6 和 iOS 7 界面?是否必须为 iOS 7 制作单独的故事板?

如果您使用的是 iOS 7,则以编程方式调整图标?

我很困惑,因为文档似乎没有提到标签栏不同大小的图标(https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/TransitionGuide.pdf 第 26 页)

事实上,这些图标看起来几乎一模一样。

但是当我在 iOS 7 中运行我的应用程序时,所有图标都缩小了。

【问题讨论】:

标签: ios ios6 ios7 icons uitabbarcontroller


【解决方案1】:

您可以使用以下方法查看当前iOS的版本,然后自定义导航栏按钮的按钮大小和外观。

 if (floor(NSFoundationVersionNumber)<=NSFoundationVersionNumber_iOS_6_1) {
        UIImage *navBarImage=[[UIImage imageNamed:@"top-bar-bg-44px.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
        [[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault];

        UIImage *barButtonImg=[[UIImage imageNamed:@"back-ios6.png"]
            resizableImageWithCapInsets:UIEdgeInsetsMake(0, 13, 0, 5)];

        [[UIBarButtonItem appearance] setBackButtonBackgroundImage:barButtonImg forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
    }

    else{


}

【讨论】:

    【解决方案2】:

    经过一番挖掘,我在这里找到了答案-Tab bar icons on retina display

    "您需要创建两个单独的图标 icon.png (30x30) 和 icon@2x.png (60x60)。 iOS 会根据屏幕比例自动加载正确的文件。”

    【讨论】:

    • 这并没有回答问题,这是关于 iOS6 和 iOS7 图标大小的差异,而不是关于非视网膜和视网膜显示器之间的差异。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-04
    • 1970-01-01
    • 1970-01-01
    • 2013-10-06
    相关资源
    最近更新 更多