【问题标题】:iPad 3rd generation can not display retina imageiPad 第三代无法显示视网膜图像
【发布时间】:2012-11-27 10:27:45
【问题描述】:

我开发了一款通用应用。我有四种类型的图像

  • iphone - simple.png
  • iphone 视网膜 - simple@2x.png
  • ipad - simple@3x.png
  • ipad 视网膜 - simple@3x@2x.png

当我尝试运行该应用程序时,它在 ipad(非视网膜)中运行良好,但在 ipad 视网膜中出现黑屏(无图像)。

在这里,输入函数代码,为我提供 iphone 和 ipad 的相关名称。

#define SHImageString(str, ext) ({ UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ? ([NSString stringWithFormat:@"%@.%@", (str), (ext)]) : ([NSString stringWithFormat:@"%@@3x.%@", (str), (ext)]); })

提前致谢。

【问题讨论】:

  • 如果你问我,命名方案真的很混乱......
  • 你能告诉我为什么它不能显示视网膜图像。
  • 尝试不同的名称,省略“@3”,这可能是选择正确图像文件的原因。
  • 之前我用过simple_ipad.png和simple_ipad@2x.png,但是没用

标签: ios xcode xcode4.5


【解决方案1】:

应该是这样的:

  • iphone-simple.png
  • iphone 视网膜 - simple@2x.png
  • ipad - simple_iPad.png
  • ipad 视网膜 - simple_iPad@2x.png

在您的代码(或 XIB)中,您只能使用没有 @2x 的文件。如果应用程序在视网膜显示器上运行,它将自动使用@2x 版本。这个我用过很多次了,完美。

【讨论】:

  • 感谢您的回答。让我检查一下
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多