Close the IOS keyboard by clicking confirm

Asked

Viewed 138 times

2

how do I make the keyboard disappear when I click a button confirming that name in the textbox?

I want that when I click the button confirm player the keyboard disappear, because it keeps appearing cutting half the screen where the game is

1 answer

1


How do you not press the Return from the keyboard in the field, you don’t have the textField in which the event occurred. Soon you need to say that the view is no longer being edited, as follows:

self.view.endEditing(true)

Another way to do this, when you know the field that has been edited (usually when you have only one on the screen you can do this), would be:

txtName.resignFirstResponder()

Where txtName is the name of your textField.

  • It worked perfectly! Thank you very much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.