有没有办法以编程方式编码LaunchScreen [英] Is there any way to code the LaunchScreen programmatically
问题描述
我正在使用Xcode7和Swift与Storyboard。当我打开LaunchScreen.storyboard,并尝试在其上设置自定义类时,Xcode抱怨在LaunchScreen故事板上不能有自定义类。
所以我的问题是,有没有办法以编程方式对LaunchScreen进行编码,因为我希望避免使用IB拖放元素。
I am using Xcode7 and Swift with Storyboards. When I open the LaunchScreen.storyboard, and I try to set a Custom Class on it, Xcode complains that one cannot have a custom class on a LaunchScreen storyboard. So my question is, is there any way to programmatically code the LaunchScreen as I would like to avoid having to drag and drop elements on it using IB.
推荐答案
不,在您的应用程序开始执行之前,会显示启动屏幕,以便在加载时提供从Springboard到应用程序的转换。
No, The launch screen is shown before your app starts executing in order to provide a transition from the Springboard to your app while it is loading.
您可以使用固定图像,也可以仅使用标准的静态UI元素使用简单的故事板场景 - 标签&图片。
You can either use a fixed image or you can use a simple storyboard scene using only standard, static UI elements - labels & images.
这个故事板场景实际上是由操作系统加载和显示的,因此允许代码在该上下文中执行会带来安全风险。
This storyboard scene is actually loaded and displayed by the OS, so it would be a security risk to allow your code to execute in that context.
这篇关于有没有办法以编程方式编码LaunchScreen的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!