У меня есть AlertController с текстовым полем и двумя кнопками: CANCEL и SAVE. Это код:
@IBAction func addTherapy(sender: AnyObject)
{
let addAlertView = UIAlertController(title: "New Prescription", message: "Insert a name for this prescription", preferredStyle: UIAlertControllerStyle.Alert)
addAlertView.addAction(UIAlertAction(title: "Cancel",
style: UIAlertActionStyle.Default,
handler: nil))
addAlertView.addAction(UIAlertAction(title: "Save",
style: UIAlertActionStyle.Default,
handler: nil))
addAlertView.addTextFieldWithConfigurationHandler({textField in textField.placeholder = "Title"})
self.presentViewController(addAlertView, animated: true, completion: nil)
}
Что я хочу сделать, так это реализовать проверку текстового поля для отключения кнопки SAVE, когда текстовое поле пуст, как и приложение "Картинки" iOS, когда вы хотите создать NewAlbum. Пожалуйста, кто-нибудь может объяснить мне, что делать?