I am using LaunchImage.launchimage in Images.xcassets to manage startup images. But I'm also trying to use startup images inside the application.
I read this answer :
The documentation indicates that the imageNamed: method on UIImage should automatically-magical select the correct version
So, I used this code
UIImageView *backImage = [UIImageView new]; backImage.image = [UIImage imageNamed:@"LaunchImage"];
When working on the iPhone 4,5,6,6+, it works fine and gets the correct LaunchImage, but when working with the iPad's retina, it returns LaunchImage-700@2x.png , which is LaunchImage iPhone 4s 640 x 960 pixels
So, how can I access the correct LaunchImage iPad programmatically?
Contents.json content in LaunchImage folder
{ "images" : [ { "extent" : "full-screen", "idiom" : "iphone", "subtype" : "736h", "filename" : " LaunchImage-800-Portrait-736h@3x.png ", "minimum-system-version" : "8.0", "orientation" : "portrait", "scale" : "3x" }, { "extent" : "full-screen", "idiom" : "iphone", "subtype" : "667h", "filename" : " LaunchImage-800-667h@2x.png ", "minimum-system-version" : "8.0", "orientation" : "portrait", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "iphone", "extent" : "full-screen", "minimum-system-version" : "7.0", "filename" : " LaunchImage-700@2x.png ", "scale" : "2x" }, { "extent" : "full-screen", "idiom" : "iphone", "subtype" : "retina4", "filename" : " LaunchImage-700-568h@2x.png ", "minimum-system-version" : "7.0", "orientation" : "portrait", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "ipad", "extent" : "full-screen", "minimum-system-version" : "7.0", "filename" : "LaunchImage-700-Portrait~ipad.png", "scale" : "1x" }, { "orientation" : "landscape", "idiom" : "ipad", "extent" : "full-screen", "minimum-system-version" : "7.0", "filename" : "LaunchImage-700-Landscape~ipad.png", "scale" : "1x" }, { "orientation" : "portrait", "idiom" : "ipad", "extent" : "full-screen", "minimum-system-version" : "7.0", "filename" : " LaunchImage-700-Portrait@2x ~ipad.png", "scale" : "2x" }, { "orientation" : "landscape", "idiom" : "ipad", "extent" : "full-screen", "minimum-system-version" : "7.0", "filename" : " LaunchImage-700-Landscape@2x ~ipad.png", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "iphone", "extent" : "full-screen", "filename" : "LaunchImage-700.png", "scale" : "1x" }, { "orientation" : "portrait", "idiom" : "iphone", "extent" : "full-screen", "filename" : " LaunchImage-700@2x.png ", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "iphone", "extent" : "full-screen", "filename" : " LaunchImage-700-568h@2x.png ", "subtype" : "retina4", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "ipad", "extent" : "full-screen", "filename" : "LaunchImage-700-Portrait~ipad.png", "scale" : "1x" }, { "orientation" : "landscape", "idiom" : "ipad", "extent" : "full-screen", "filename" : "LaunchImage-700-Landscape~ipad.png", "scale" : "1x" }, { "orientation" : "portrait", "idiom" : "ipad", "extent" : "full-screen", "filename" : " LaunchImage-700-Portrait@2x ~ipad.png", "scale" : "2x" }, { "orientation" : "landscape", "idiom" : "ipad", "extent" : "full-screen", "filename" : " LaunchImage-700-Landscape@2x ~ipad.png", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } }
Thanks in advance.