作業35#練習拉 IBSegueAction&從 controller 連 segue 到下一頁
呼叫 performSegue 切換
Published in
Mar 18, 2024
一. 第一頁的View Controller先加入Button&拉IBAction
@IBAction func tap(_ sender: Any) {
performSegue(withIdentifier: "showGrade", sender: nil)
}
第二頁再加一個 View Controller& Label
二. 把第二頁的Class 改 SecondViewController
加入ㄧ些程式及拉IBOutlet
if let num {
label.text = "\(num)"
}
// 顯示數字 因為是optional 最好是用if let 來寫