1. 程式人生 > >iOS開發(swift):頁面跳轉之設定第一次執行的介面

iOS開發(swift):頁面跳轉之設定第一次執行的介面

0.介面回顧

 

1.在AppDelegate檔案中新增如下程式碼

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        window=UIWindow(frame:UIScreen.main.bounds)
        window?.rootViewController = RedViewController()   //通過修改這句話決定程式第一次停留的頁面,此處為紅色頁面(.storyboard)
        //window?.rootViewController = BlueViewController(nibName:"BlueViewController",bundle:nil)   //通過修改這句話決定程式第一次停留的頁面,此處為藍色頁面(.xib)
        window?.makeKeyAndVisible()
        return true
    }


}