0
我目前遇到UIAlertController關閉按鈕的問題。每次我選擇完成按鈕它應該檢查大小寫,然後如果大小寫符合,顯示UIAlertController。然而,我面臨的問題是當警報出現時,我選擇解除按鈕,然後再次選擇完成按鈕,有兩個解除按鈕,每次我選擇完成時,另一個解除按鈕被添加。UIAlertController關閉按鈕問題
let alertController = UIAlertController(title: "Alert", message: "Enter Information In All Fields", preferredStyle: UIAlertControllerStyle.Ale
func doneButtonSelected(){
if (doctorName.text == "" || doctorEmail.text == "" || doctorNumber.text == ""){
print("This is empty")
alertController.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.Default,handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
}
else{
}
}
哈哈這種低級錯誤裏面。謝謝。 – OriginalAlchemist