mmoore410
mmoore410

Reputation: 427

Want to hide keyboard with the press of a button in iOS

I've got an app with user input to enter some numbers and instead of having to push the done key on the keyboard to hide it I'd like for the keyboard to go away when they press the calculate button but I have not been able to figure out how to do this. Some hints please? Thanks

Upvotes: 2

Views: 1511

Answers (2)

Johnmph
Johnmph

Reputation: 3391

In iOS you need to "resign" from being first responder in order for the keyboard to be removed from the screen. Simply call resignFirstResponder on your textfield:

[_yourTextFieldWithNumbers resignFirstResponder];

Upvotes: 3

Related Questions