![](/img/trans.png)
[英]iOS 13 - Can we use xib as a launch screen over launch storyboard?
[英]iOS: Can we use different launch screen storyboard for different schema in iOS Application
您可以复制现有的应用程序目标并将其启动屏幕设置为不同的启动屏幕,然后设置您的第二个方案来运行复制的目标。
启动 storyboard 在每个目标生成的 Info.plist 文件中定义。 如果你想使用默认方式,那么你必须有不同的目标。 如果你想要一个解决方法,比如使用配置的脚本,在didFinishLaunchingWithOptions
中或之后的额外 LaunchScreens 那么也许这是可能的,但实现它会更复杂。
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
嗯,如何将所需的Launch Screen
放在 UIWindow 的keyWindow
之上?
UIWindow是 UIView 的子类,所以很容易在它上面再放一个 UIView。 只需在应用程序完成启动后实施这些。
// AppDelegate callback after app did launch.
func application(application: UIApplication,
didFinishLaunchingWithOptions: launchOptions: [NSObject: AnyObject]?) -> Bool
作为找到的教程,iOS app 100% programmatically swift,它的UIWindow
和rootController
都来自代码。
SceneDelegate 文件中的 Go 并在 willConnectTo function 中手动设置条目 controller,如下所示:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
window?.backgroundColor = .white
window?.makeKeyAndVisible()
let controller = YourPrfereStartController() // set here the name of controller that you want to start
window?.rootViewController = controller
}
之后一般为 go 并删除 main 如下图
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.