加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

objective-c – 在Xcode中指定iPad的图像,例如@ 2x for iPhone 4

发布时间:2020-12-15 01:53:24 所属栏目:百科 来源:网络整理
导读:我将目前的目标升级到iPad,并制作了一个通用的应用程序,如果有这个问题的答案,那么将ipad应用程序调整到ipad的时间会显着下降。 在这个时候,大家都知道,如果你有一个名为“football.png”的图像,并希望支持Retina Display,你应该将图像的大小加倍,并
我将目前的目标升级到iPad,并制作了一个通用的应用程序,如果有这个问题的答案,那么将ipad应用程序调整到ipad的时间会显着下降。

在这个时候,大家都知道,如果你有一个名为“football.png”的图像,并希望支持Retina Display,你应该将图像的大小加倍,并将其称为“football@2x.png”。

我的问题是,如果有一些iPad,像*football@iPad_which_is_another_size.png*?

如果没有办法这样做,我必须将每个图像连接到IBOutlet并以编程方式设置框架?

解决方法

In iOS 4.0 and later,it is possible
to mark individual resource files as
usable only on a specific type of
device
To associate a resource file with a
particular device,you add a custom
modifier string to its filename. The
inclusion of this modifier string
yields filenames with the following
format:

<basename><device>.<filename_extension>

要加载iPad的具体资源,你应该使用?ipad。示例:创建名为AwesomeImage?ipad.png的图像,并使用[UIImage imageNamed:@“AwesomeImage.png”]加载,就像您对视网膜显示图像一样。

欲了解更多信息:http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/LoadingResources/Introduction/Introduction.html在“iOS支持设备特定资源”部分。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读