How to hide the keyboard when I press return key in a UITextField?

前端 未结 12 1452
野趣味
野趣味 2020-12-04 07:31

Clicking in a textfield makes the keyboard appear. How do I hide it when the user presses the return key?

12条回答
  •  既然无缘
    2020-12-04 07:59

    If you want to hide the keyboard for a particular keyboard use [self.view resignFirstResponder]; If you want to hide any keyboard from view use [self.view endEditing:true];

提交回复
热议问题