hide keyboard for text field in swift programming language

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

    You can try this code to have the "return" key execute code.

    func textFieldShouldReturn(textField: UITextField) -> Bool{
        textField.resignFirstResponder()
        performAction()
        return true;
    }
    
    func performAction(){
    
    //execute code for your action inside this function
    
    }
    

    Hope this can help you.

提交回复
热议问题