views:

42

answers:

2

Anybody can tell me how to add "dismiss key" to iPhone's virtual keyboard?

A: 

I doubt it is a proper way to add button to a standard keyboard. You should add a button to your view which "tells" your controller (via addTarget...) to send resignFirstResponder message to the text field or search bar that has called the keyboard

NR4TR
+1  A: 

You can add an InputAccessoryView which will sit on top of the virtual keyboard (the height is adjustable but the width will always be the width of the keyboard).

If you open the Safari app, when you tap into a textfield, you'll see a bar above the keyboard, this is an example of an InputAccessoryView

On this accessory view, you can add a button, that when clicked will resign first responder to all of all the appropriate fields on the current view. This will dismiss the keyboard, no matter what what is currently in focus.

Luke
Thanks for your help:)
leduchuy89vn