Use Launch Image for Launch Screen

霸气de小男生 提交于 2019-12-23 06:37:46

问题


using xcode 7 I wanna to create a Launch Screen with the same image for all iPhones.

In the application main target -> General -> App Icones and Launch Images -> Launch Image Source I have selected the "LaunchImage"

In the assets I created a LaunchImage (App Icons & Launch Images->New iOS Launch Image) and I put all the images applicable to the various devices.

When I start my app there isn't launch image. Anyone know why? Thanks to all


回答1:


As i mentioned in the comment remove the Launch screen file value from the Launch(application main target) -> General -> App Icons and Launch Images -> Launch screen file, so it will be likes this

After that you run it, it should be there




回答2:


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")
        default:
            self.init(named: name)
        }
    }
}

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

@Pyro, thanks for your help



来源:https://stackoverflow.com/questions/36581320/use-launch-image-for-launch-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!