I’m writing a universal app that supports rotation. When app starts, it needs to download some data from internet, so I push a UIViewController with activity indicator, because it is not possible to have animated launch images or add labels or objects to it.
I would like the “loading” VC has the same bg image as launch, but, because it is a universal app, I can’t set a simple [UIImage imageNamed:@”Default.png”] because it can running on iPhone or iPad and if iPad can be launched in portrait or landscape (iPhone apps always start in portrait).
The question is: there’s a way to know which Default.png has been used as launch image? it can be
- Default.png (@2x if retina)
- Default-Portrait.png (@2x if retina)
- Default-Landscape.png (@2x if retina)
- Default-568h@2x.png
If there’s now way, I will check currentDevice and orientation and set imageNamed manually.
Thanks,
Max
There is no suffix for portrait and landscape. You will have to check the orientation manually with
[[UIDevice currentDevice] orientation].For showing different images for the iPad and iPhone/iPod Touch, you can add
~ipadonto the end of the iPad image and~iphoneonto the end of the iPhone/iPod Touch image. Example:Default~iphone.png will load on iPhone/iPod Touch and Default~ipad.png will load on iPad with this:
There is also no specifier for iPhone 5 though. So you will have to check
[[UIScreen mainScreen] bounds].size.heightand again load theUIImagemanually.FULL (untested) EXAMPLE:
To answer your question in the comments:
No, you cannot query what launch image was used at runtime.