[UIImage imageNamed:] in +(void)load taints the image used, preventing it from loading with scale 2.0
| Originator: | fbartho | ||
| Number: | rdar://16650853 | Date Originated: | 17-Apr-2014 02:04 PM |
| Status: | Closed | Resolved: | |
| Product: | iOS SDK | Product Version: | 7.1 |
| Classification: | Other Bug | Reproducible: | Always |
Summary: in +(void)load for a ViewController, I was referencing an image using UIImage imageNamed:, and then capturing the image.size for later use. (We were creating a UIImage from [UIColor clearColor] and wanted it to have the same size as the referenced image asset) This was causing that image when later referenced to fail to find the @2x form for retina devices. Steps to Reproduce: 1. Create viewController that displays a simple list of images, using [UIImage imageNamed:] with at least 2 variants, non-retina/retina. 2. Reference one of those images in +(void)load using [UIImage imageNamed:], and access the .size property. 3. Run this app on a Retina device. Expected Results: Expected all the retina images to load the asset for the appropriate image scale. Actual Results: The image referenced from +(void)load will only load the non-retina image, regardless of the device you run it on Regression: We first noticed this problem I believe on 7.0, but currently have only been testing on 7.1 Notes: Workaround: Hardcode the imageSize manually instead of reading it from the asset, or lazy load the clearImage. Apple Developer Relations Engineering has requested a test case/sample app in order to further investigate this issue. Test Case/Sample App Requirements: https://developer.apple.com/bug-reporting/ios/test-case/
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!