Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

swiftの画面遷移でつまづいた話

Last updated at Posted at 2022-03-19

はじめに

swiftでのアプリ開発をしていたのですが,新しく画面遷移を作ろうと思ったら,うまくいかずつまづいたので,自分への備忘録的な感じで書いときます.

エラー文

has no segue with identifier 'toPersonalPage'

結論から言うと

Storyboard SegueのIdentifierを設定していなかった.

スクリーンショット 2022-03-19 20.51.41.png

画面遷移のやり方

ボタンタップの関数
@IBAction func tapEnterButton(_ sender: Any) {
    performSegue(withIdentifier: "toPersonalPage", sender: (memArray, tappedBtnTag))
}

上記のようにエンターボタンがタップされた時の関数を作る.
この時にコントロールキーを押しながら,stroryboardに設置されたボタンをViewControllerの関数を置きたい部分に部分に持ってくると対応づけられて,行番号のところに二重丸が表示される.

storyboardの方で同様にコントロールキーを押しながら遷移前の画面のviewcontrollerを選んで次の画面に引っ張ってくるとsegueのマークが表示される.

で,segueのマークを選んで,上の画像のようにidentifierを設定する.

1
1
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

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?