hide keyboard for text field in swift programming language

后端 未结 14 1072
不思量自难忘°
不思量自难忘° 2020-11-27 17:07

I have little experience in Objective-C. I want to hide the keyboard for a text field using the Swift programming language.

I also tried this

func te         


        
14条回答
  •  独厮守ぢ
    2020-11-27 17:48

    when you call your UIAlertController, place condition in the completion handler if you'd like to hide the keyboard.

    self.present('nameOfYourUIAlertController', animated: true, completion: {
        if condition == true {
            'nameOfYourUIAlertController'.textFields![0].resignFirstResponder()
        }
    })
    

    This works great for me.

提交回复
热议问题