开发者

How to make "dismiss keyboard" on iPhone?

Anybody can tell me how to a开发者_StackOverflowdd "dismiss key" to iPhone's virtual keyboard?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜