如果设备版本为 iOS 8,则删除启动屏幕

Remove launch screen if device version in iOS 8

我有一个适用于 iOS 7 和 8 的应用程序,我使用的是自动布局,因此在所有 iPhone 上都可以。对于 iOS 7,我需要启动屏幕文件,但对于 iOS 8,我想隐藏它。 如何专门为 iOS 8 删除它?

提前致谢:)

HIG 中它说了以下...

In iOS 8 and later, you can create a XIB or storyboard file instead of a static launch image...

..

If you also need to support earlier versions of iOS, you can continue to supply static launch images in addition to a launch file.

启动屏幕由 iOS 在其他任何事情发生之前进行处理和显示。您不能以编程方式执行任何操作来影响启动屏幕,因为您的代码 运行 直到显示启动屏幕后才会显示。

所以你唯一能做的就是利用 iOS8 引入的 xib 启动屏幕支持,提供两种不同的启动屏幕:一个用于 iOS8+(xib)一个用于 iOS7 及更低版本(png)。