相关疑难解决方法(0)

检查UIAlertController TextField以启用该按钮

我有一个带文本字段和两个按钮的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)


}
Run Code Online (Sandbox Code Playgroud)

我想要做的是在文本字段为空时执行检查以禁用SAVE按钮,就像想要创建NewAlbum的iOS的图片应用程序一样.请有人能解释一下该怎么办?

alert ios swift uialertcontroller

28
推荐指数
2
解决办法
2万
查看次数

如何在uialertview控制器的uitext字段中没有输入时禁用两个uialertcontroller按钮

看看我的下面的代码.我正在尝试使用uialertviewcontroller.Now添加文本字段当我的两个文本字段中没有输入时我需要禁用两个操作按钮.怎么做?

请提出一些可能的解决方案.谢谢!!

objective-c ios uialertcontroller

6
推荐指数
1
解决办法
6530
查看次数

标签 统计

ios ×2

uialertcontroller ×2

alert ×1

objective-c ×1

swift ×1