How can I create UIKeyboard with done button on to

2020-04-12 06:16发布

问题:

I need to show UIKeyboard with done button on top right corner ..please look into attached image..any help would be appreciated.

回答1:

This might help you. please check it out BSKeyboardControls



回答2:

Create a UIToolbar keep two bar buttons in that. Initially Hide that toolbar.

Show the toolbar on the textfield didBeginEditing delegate of textfield

and hide the toolbar in didEndEditing delegate of textfield

EDIT: As prashant said BSKeyboard offers what i said. See the look and feel of it here http://www.cocoacontrols.com/platforms/ios/controls/bskeyboardcontrols



回答3:

You should set inputAccessoryView propery of UITextField or UITextView to your custom view with all required buttons

@property(readwrite, retain) UIView *inputAccessoryView

Description
The custom accessory view to display when the text field becomes the first responder The default value of this property is nil. Assigning a view to this property causes that view to be displayed above the standard system keyboard (or above the custom input view if one is provided) when the text field becomes the first responder. For example, you could use this property to attach a custom toolbar to the keyboard.