Help us understand the problem. What is going on with this article?

Swiftにおける画面遷移には、2つある

More than 1 year has passed since last update.

初めに

この記事は、メモがわりです。ご了承ください。

画面遷移については、こちらを参考にしてください。
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()で利用する

といい。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした