iOS 3.x 支持 [UIImage imageNamed:]
在我的应用程序中,我正在加载像 [UIImage imageNamed:@"fileName"]
(不带扩展名)这样的图像,它与 iOS 4.x 设备完美配合。为了支持视网膜显示,每个图像都有两个版本(带有“@2x”)。
回到 iOS 3.x 设备上,图像不会加载,这与缺少文件扩展名有关。
如果使用扩展名 ([UIImage imageNamed:@"fileName.png"]
) 加载图像并且还支持视网膜显示,它可以工作吗?在本例中,是在视网膜设备上加载的图像“[email protected]”或“文件名.png”?
问题是,我没有运行 iOS 3.x 的设备进行测试。
In my application I'm loading images like [UIImage imageNamed:@"fileName"]
(without extension) which works perfect with iOS 4.x devices. To support the retina display every image is available in two versions (with the "@2x").
Back on iOS 3.x devices images are not loaded, which has to do with the missing file extension.
Does it work if images loaded with the extension ([UIImage imageNamed:@"fileName.png"]
) and also support the retina display? In this case is the image "[email protected]" loaded on retina devices or "fileName.png"?
The problem is, that I don't have a device running iOS 3.x for testing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 iOS SDK >= 4.x
[UIImage imageNamed:@"fileName.png"]
在两种情况下都会自动加载 @2x 图像文件(带或不带 .png 扩展名)。如果您正在使用 iOS SDK < 4.X 不支持自动加载@2x 文件。
但是,即使您使用 SDK 4.x 将构建选项“部署 iOS 目标”设置为 iOS 3.x 值,您也可以继续在 iOS 3.x 上部署应用程序。
您可以在旧版 iOS 上测试您的应用程序,下载旧版本的 SDK 并设置除默认“/Developer”之外的安装路径,通过执行此操作,iOS 模拟器将显示所有可用的 iOS 版本。
If you are working with iOS SDK >= 4.x
[UIImage imageNamed:@"fileName.png"]
automatically load @2x image file in both cases (with or without .png extension).If you are working with iOS SDK < 4.X autoloading @2x file is not supported.
However, you can continue to deploy your application on iOS 3.x even if you use the SDK 4.x setting the build option "Deploy iOS target" to iOS 3.x value.
You can test your application on older iOS downloading older versions of the SDK and setting up an installation path other than the default "/Developer", by doing this the iOS simulator will show all iOS version available.
如果捆绑包中有可用的话,它将自动拍摄 @2x 图像...
It will automatically takes @2x images if it is available in the bundle...