您正在尝试通过在文本字段中输入特定单词来执行segue。 到目前为止,我的教练技巧让我想到了这一点。 我没有收到错误,模拟器崩溃了。
任何提示?
导入UIKit
类CodewordVC:UIViewController,UITextFieldDelegate { @IBOutlet weak var passWordInput:UITextField!
override func viewDidLoad() {
super.viewDidLoad()
passWordInput.delegate = self }
@IBAction func LosButton(_ sender: UIButton) {
//passwords
let realPassword1 = "rudi"
if passWordInput.text == realPassword1 {
self .performSegue(withIdentifier: "rudi", sender: self)
}
func dismissButton(_ sender: UIButton) {
dismiss(animated: true, completion: nil)
答案 0 :(得分:0)
搞定了! 无法解释,但那就是答案:
import UIKit
class CodewordVC: UIViewController, UITextFieldDelegate {
@IBOutlet weak var passWordInput: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
}
let realPassword1 = "rudi"
@IBAction func LosButton(_ sender: UIButton) {
passWordInput.delegate = self
//passwords
if self.passWordInput.text == realPassword1 {
DispatchQueue.main.async(){
self.performSegue(withIdentifier: "rudi", sender: self)
}
}
}
func dismissButton(_ sender: UIButton) {
dismiss(animated: true, completion: nil)
}
}