Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 9 iPad Keyboard get rid of "undo view"

How is it possible to get rid of this annoying "undo view" shown on the iPad in iOS 9. enter image description here

Below is my own keyboard, above my accessory view. (just for testing purposes in this ugly color). Can someone please tell me how to remove it? Thanks in advance.

like image 843
borchero Avatar asked Sep 19 '15 15:09

borchero


1 Answers

For Swift 2.0, You can place this code in viewDidLoad and it will work like a charm.

if #available(iOS 9.0, *) {
    let item = yourTextView.inputAssistantItem
    item.leadingBarButtonGroups = []
    item.trailingBarButtonGroups = []
} else {
    // Fallback on earlier versions
}

In Swift 3.0 and 4.0

youtTextField.inputAssistantItem.leadingBarButtonGroups.removeAll()
yourTextField.inputAssistantItem.trailingBarButtonGroups.removeAll()

However the best way to use this is to subclass a UITextfield and use the above code in the init() phase. Or to create an extension Instead of using it in the viewDidLoad for each and every textField.

like image 199
OverD Avatar answered Oct 02 '22 23:10

OverD