初めに
この記事は、メモがわりです。ご了承ください。
画面遷移については、こちらを参考にしてください。
https://ja.stackoverflow.com/questions/17290/swift-segue%E3%81%AE%E7%A8%AE%E9%A1%9E%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6
通常の画面遷移の場合
self.present(SenddetailViewController, animated: true)
戻る場合は、
@IBAction func tapCloseBtn(_ sender: Any) {
self.dismiss(animated: true, completion: nil)
}
navigation cotlollerの場合
let SecondViewController = self.storyboard?.instantiateViewController(withIdentifier: "SecondVC") as! SecondViewController
self.navigationController?.pushViewController(SecondViewController, animated: true)
//遷移先のBox変数に、このコードないの変数Stringを代入する
SecondViewController.Box = String
戻る場合は、
@IBAction func tapCloseBtn(_ sender: Any) {
self.navigationController?.popViewController(animated: true)
}
この場合は、Storybordでどこへ遷移させるのかを遷移ものとのVIew(上のコードを書くview)の左上の丸印から
遷移先のviewの全体に対してControl で繋げる必要がある。
追記
NavbarやTabbarの先頭に戻りたいとき
segueを利用して戻る
performSegue()で利用する
といい。