Search code examples
ioscocoauiimageviewuidevice

IOS UIImage of launch image for current device


is there way to get launch image as UIImage for current device? or UIImageView with an image


Solution

  • You just need to get Default.png which will have any @2x applied as necessary.

    - (UIImage *)splashImage {
        return [UIImage imageNamed:@"Default.png"];
    }
    

    If you care about getting the iPhone 5 specific one you need to do a height check:

    - (UIImage *)splashImage {
        if ([[UIScreen mainScreen] bounds].size.height == 568.0){
            return [UIImage imageNamed:@"Default-568h.png"];
        } else {
            return [UIImage imageNamed:name];
        }
    }