LoginSignup
1
0

More than 5 years have passed since last update.

Navigation Controllerを間に挟んだ遷移

Last updated at Posted at 2018-06-16

image.png
FirstView→NavigationController→SecondView
のように遷移したい

同じストーリーボードでセグエは使わない方法

FirstView→NavigationController→SecondView

sample.swift
 func test() {
    let storyboard = UIStoryboard(name: "view1", bundle: NSBundle.mainBundle())
    let naviView = storyboard.instantiateViewControllerWithIdentifier("Second") as! UINavigationController
    let view = naviView.topViewController as! SecondView
    view.hogehoge = "ほげほげ"
    self.navigationController?.pushViewController(view, animated: true)
}

セグエを使う場合

FirstVCからpresent modallyでの遷移をつくる
その後、SecondVCにEmbed inでnavigation controllerを入れ込めばよい

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0