How to dismiss an UIAlertController and the keyboard simultaneously?

后端 未结 8 1235
离开以前
离开以前 2021-02-05 13:04

I have created a signup form with a UIAlertController and used the method addTextFieldWithConfigurationHandler to add a text field. But there is a litt

8条回答
  •  太阳男子
    2021-02-05 13:16

    Its pretty simple.

    if your UIAlertController delegate are present in self View Controller. then you can do it in its delegate method for Dismiss AlertController. You can [youtTextField resignFirstResponder] in your UIAlertController object which have a button for dismiss it. (like OK or Cancel) so your presented KeyBoard will be dismissed.

    I didn't tried it but It will work. but you have to handle textField and Alert correctly.

提交回复
热议问题