2017-05-05 3 views
1

ストーリーボード内に3つのView Controllerがあると仮定し、それらをすべてView Controllerスタックにロードしたいが、最初にどちらを表示するかを選択したい。以下に示すように、私は最初の、接着剤を表示する代わりに、負荷の3番目のビューを表示したいと思いますか?ストーリーボードを使用して1すべてのView Controllerを読み込む方法はありますが、自然なシーケンスをスキップして特定のビューに直接移動しますか?

enter image description here

答えて

2

オプション、あなたは、あなたの最初のビューコントローラの負荷にビューコントローラに2または3

オプション2というあなたのViewController 1.ドラッグを指す矢印を参照してください各ストーリーボードビューにIDを指定していれば、instantiate whichever view you'd like in your viewDidLoad()とすることができます。

let storyboard = UIStoryboard(name: "Main", bundle: nil) 
let controller = storyboard.instantiateViewController(withIdentifier: "YourVCIdentifier") 
self.present(controller, animated: true, completion: nil) 

オプション3. In your AppDelegate file, you can do this.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
    self.window = UIWindow(frame: UIScreen.main.bounds) 

    let storyboard = UIStoryboard(name: "Main", bundle: nil) 

    let initialViewController = storyboard.instantiateViewController(withIdentifier: "YourVCIdentifier") 

    self.window?.rootViewController = initialViewController 
    self.window?.makeKeyAndVisible() 

    return true 
} 
関連する問題