前提・実現したいこと
ボタンを押した時に、現在の画面のcountに入っている値を次の画面の変数countに入れて表示したいのですが以下のコードではうまくいきません。
改善点など教えて頂きたいです。
発生している問題・エラーメッセージ
エラーメッセージ
該当のソースコード
@IBAction func stop(_ sender: Any) {
//countLabel&timeLabelの値を渡す performSegue(withIdentifier: "toResultViewController", sender: nil) } //countLabel&timeLabelの値をResultViewControllerに遷移の関数 override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if (segue.identifier == "toResultViewController") { let toRVC = segue.destination as! ResultViewController ResultViewController.countLabel = count } }
swift
1 2コード@IBAction func stop(_ sender: Any) { 3 4 5 //countLabel&timeLabelの値を渡す 6 performSegue(withIdentifier: "toResultViewController", sender: nil) 7 8 } 9 10 //countLabel&timeLabelの値をResultViewControllerに遷移の関数 11 override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 12 if (segue.identifier == "toResultViewController") { 13 let toRVC = 14 segue.destination as! ResultViewController 15 16 ResultViewController.countLabel = countLabel 17 } 18 } 19``
ソースコード
### 試したこと ここに問題に対して試したことを記載してください。 ### 補足情報(FW/ツールのバージョンなど) ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー