Swift Uitextfield通知到xcode 12
uitextfield如何显示消息在执行之前必须先填充? 我在谷歌上搜索过,但没找到Swift Uitextfield通知到xcode 12,swift,xcode12,Swift,Xcode12,uitextfield如何显示消息在执行之前必须先填充? 我在谷歌上搜索过,但没找到 您的意思是显示一条消息,说明在前进之前必须填写文本字段吗? 如果是,请在每个文本字段上使用If语句 if namaField.text == "" || alamatField.text == "" || phoneField.text == "" { let alertController = UIALertController(title:
您的意思是显示一条消息,说明在前进之前必须填写文本字段吗? 如果是,请在每个文本字段上使用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)
}
太好了,我会试试你应该用isEmpty变量:namaField.text检查textField empty。isEmpty@goat_herd最好只使用
uikeyinport
propertyhasText
if!(namaField.hasText&&alamatField.hasText&&phoneField.hasText){