hide keyboard for text field in swift programming language

后端 未结 14 1096
不思量自难忘°
不思量自难忘° 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:30

    You can also do like this: add event "Did end on exit" from connections inspector of your TextField and connect it to method from relevant ViewController

    In my example I connect it to method called 'ended'

    declare sender as UITextField and then call sender.resignFirstResponder(); Like this:

    @IBAction func ended (sender: UITextField){ sender.resignFirstResponder(); }
    

提交回复
热议问题