问题描述
如何在执行之前先填充uitextfield出现消息? 我已经搜索过Google,但是找不到它。
解决方法
您的意思是显示一条消息,说在前进之前必须填充textFields吗? 如果是这样,请在每个textField上使用if语句
if namaField.text == "" || alamatField.text == "" || phoneField.text == "" {
let alertController = UIALertController(title: "Enter all fields",preferredStyle: .alert)
let okayAction = UIAlertAction(title: "Okay",style: .default,handler: { action in
self.dismiss(animated: true,completion: nil)
})
alert.addAction(okayAction)
self.present(alert,animated: true)
}