2016/11/16

【iOS】【swift3】コードからstoryboardに画面遷移する

Next.storyboard 、storyboard idはnext に遷移する場合
       let storyboard = UIStoryboard(name: "Next", bundle: nil)
       let nextVC = storyboard.instantiateViewController(withIdentifier: "next")
       self.present(nextVC, animated: true, completion: nil)


NavigationControllerを使う場合は
       let storyboard = UIStoryboard(name: "Next", bundle: nil)
       let nextVC = storyboard.instantiateViewController(withIdentifier: "next")
       let navigationController = UINavigationController(rootViewController: nextVC)
       self.present(navigationController , animated: true, completion: nil)

これでNavigation Barが表示される。