Alessio Volpe Alessio Volpe - 2 years ago 111
Swift Question

LaunchImage persistent

Using Xcode 7 I wanna to create a small application with a UIWebView.
This app will have to run it from all devices.
I'm using "New iOS Launch Image" in Assets.
But when the "Launch" terminate there is a waiting time (which varies from connection speed ) before that WebView is loaded .
In this time I would like to "Launch Screen" that continue to persist using the Image for the type of device .

Can you help me?

Answer Source

I solved it with this code:

extension UIImage {
    convenience init?(fullscreenNamed name: String)  {
        switch UIScreen.mainScreen().bounds.size.height {
        case 480: //iPhone 4/4s
            self.init(named: "\(name)-700@2x.png")
        case 568: //iPhone 5/5s
            self.init(named: "\(name)-700-568h@2x.png")
        case 667: //iPhone 6/6s
            self.init(named: "\(name)-800-667h@2x.png")
        case 736: //iPhone 6+/6s+
            self.init(named: "\(name)-800-Portrait-736h@3x.png")
            self.init(named: name)

I take in "LaunchImage" the right image for the device screen in use.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download