How to resign or hide the keyboard?

I have a selection list to select a day and a text box to show the selected date. It will be so ...

alt text

If I choose any date, it will be so ...

alt text

The cross character in the text box receives the code ....

textField.clearButtonMode=UITextFieldViewModeAlways;

Now my problem is that when I click on this cross button, the keyboard is displayed. What is it like....

alt text

But I want the button to cross only erasing the text field. The keyboard should not appear. Is it possible?

+3
source share
4 answers

On UITextFieldDelegate, implement the method implementation - (BOOL)textFieldShouldBeginEditing:(UITextField *)textFieldand return NO;

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
return NO;
}
+3
source

" " :

[UITextField resignFirstResponder];

.

:)

+3

editable false.

+1

Source: https://habr.com/ru/post/1787382/


All Articles