16

I have created a custom inputView for my UITextField. The view itself looks and functions great, but on the iPad I'm getting undo, redo, and paste buttons above my custom inputView. How do I remove those buttons? They don't have any functionality, but they should be removed.

enter image description here

Mike Walker
  • 2,944
  • 8
  • 30
  • 62

3 Answers3

31

With Swift 3 and XCode 8 I was able to remove the bar by removing the two button groups on the text field input:

self.textField.inputAssistantItem.leadingBarButtonGroups.removeAll()
self.textField.inputAssistantItem.trailingBarButtonGroups.removeAll()
Retebitall
  • 475
  • 5
  • 8
7
// hide undo, redo, paste button bar for textfield input view
UITextInputAssistantItem* item = [your_textfield inputAssistantItem];
item.leadingBarButtonGroups = @[];
item.trailingBarButtonGroups = @[];

will hide the top bar for input view.

Reference:How to hide the shortcut bar in iOS9

Community
  • 1
  • 1
Yuchao Zhou
  • 1,062
  • 14
  • 19
-3

Try removing the inputAccessoryView:

self.textField.inputAccessoryView = nil;
n00neimp0rtant
  • 905
  • 1
  • 8
  • 18
  • 3
    That didn't work but did help lead me in the correct direction. Instead of using `inputAccessoryView`, I needed to modify the `inputAssistantItem`. This SO post was very helpful: http://stackoverflow.com/questions/32606655/how-to-hide-the-shortcut-bar-in-ios9 – Mike Walker Nov 03 '15 at 14:43
  • I'm trying to do the same thing with a picker - but InputAssistantItem is read only...? – jbyrd May 25 '16 at 16:48