前提・実現したいこと
navigation controllerとsegueを使っておみくじアプリを作ろうと思っています。
最初の画面に配置したButtonを押して次の画面のLabelに乱数の結果を表示したいです。
該当のソースコード
import UIKit
class ViewController: UIViewController {
var counter = 0
@IBAction func move1(_ sender: Any) { counter = counter + 1 print(counter) if counter == 1{ self.performSegue(withIdentifier: "goSetting", sender: nil) counter = 0 } } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. }
}
補足情報(FW/ツールのバージョンなど)
Buttonを押して画面遷移のみできている状態です。
ここから乱数を組み込んで次画面のLabelに反映させるにはどうすればよいでしょうか?
コードは ``` で囲って下さい。
回答1件
あなたの回答
tips
プレビュー