練習程式碼Segue轉場及傳值
2 min readDec 9, 2017
@IBAction func myBtn(_ sender: UIButton) {if let myTxt = myTxt.text {if myTxt == "" {let uiac = UIAlertController(title: "提醒", message: "請輸入訊息", preferredStyle: .alert)let action = UIAlertAction(title: "OK", style: .default, handler: nil)uiac.addAction(action)present(uiac, animated: true, completion: nil)} else {performSegue(withIdentifier: "twoVC", sender: myTxt)}}}override func prepare(for segue: UIStoryboardSegue, sender: Any?) {if segue.identifier == "twoVC" {if let twoVC = segue.destination as? TwoVC {twoVC.infoFromOne = sender as? String}}}
present能夠推出viewcontroller
ppresentSegueg是符合Seguegid
prepare可想成準備傳值前的預備動作