我想建立一个永无止境的循环。
是更好 while true
还是while 1==1
?
语言:Python。
答案 0 :(得分:4)
1 == 1简单地评估为True,所以改为正确并使用
override func viewDidLoad() {
super.viewDidLoad()
currentUsername.text = currentUser?.username
currentEmail.text = currentUser?.email
saveButton.isHidden = true
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
saveButton.isHidden = false
return true
}
@IBAction func saveButtonPressed(_ sender: Any) {
if currentUsername.text != currentUser?.username {
currentUser?.saveInBackground()
saveButton.isHidden = true
}
}