【问题标题】:how to support custom graphics in iPhone 5如何在 iPhone 5 中支持自定义图形
【发布时间】:2012-09-13 00:52:28
【问题描述】:

如何在 iPhone 5、4 英寸显示屏中支持自定义图形。
我知道对于默认值,它需要添加 -568h 前缀,并且当我的状态栏被隐藏并且我的背景图像大小为 640 x 1136 像素时它可以工作。但是,当我需要为小于 1136 像素的屏幕添加自定义背景时,它就不起作用了。
那么如何在新的 Retina 显示器中支持自定义图形呢?

【问题讨论】:

    标签: iphone ios uiimage ios6


    【解决方案1】:

    你可以用我的三个#defines:

    #define isPhone568 ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568)
    #define iPhone568ImageNamed(image) (isPhone568 ? [NSString stringWithFormat:@"%@-568h", image] : image)
    #define iPhone568Image(image) ([UIImage imageNamed:iPhone568ImageNamed(image)])
    

    只需为您的图像添加 -568h@2x.png 符号,然后使用 iPhone568ImageNamed 获取标准名称或 iPhone 5/新 iPod 的名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-07
      • 1970-01-01
      • 2019-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多