How to add button above the keyboard like this one in Stack Exchange app? And when you long press the text in UITextView How to add "Select" and "Select All"?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- How can I add media attachments to my push notific
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
I would recommend to create a
toolbar
for yourUITextField
's accessoryView property.The idea is to add this
toolbar
once, before the textfield would show for the first time. Therefore, we assign thedelegate
to self, and override thetextFieldShouldBeginEditing
delegate call with our implementation to add theaccessoryView
.Here is a simple example, how can u achieve it:
This should be your output:
to add a toolbar with a done button which dismisses the keyboard above a UITextField you can write a UITextField extension with the following function:
you can then call the function in your textfield like this:
The first question, you can set
textField
'sinputAccessoryView
to your custom view, this can customize the keyboard's header.The result:
You can do it like below;
first, you should instance the view you want to add above the keyboard.
In your
CustomAccessoryView
, you can set the action of the button:Just copy and paste simple code for you accessory button embedded with keypad