![](/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.