开发者

iOS 3.x support for [UIImage imageNamed:]

开发者 https://www.devze.com 2023-02-05 10:04 出处:网络
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 tw

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 "fileName@2x.png" loaded on retina devices or "fileName.png"?

The problem is, that I don't have a device runni开发者_开发技巧ng iOS 3.x for testing.


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.


It will automatically takes @2x images if it is available in the bundle...

0

精彩评论

暂无评论...
验证码 换一张
取 消