Geof-Crowl / custom-input-view-swift-hiding-uitextinputassistan
Suggested Reading
Salt Lake City Canyon Info For Bikes
Introducing Air Lookout 2
Collection of Human Interface and Software Design Guides
Air Lookout 1.4: All The Complications
Kawasaki KLR 650 Rebuild Compilation

Friday, Aug. 17th 2018

Custom Input View on iOS: Hiding UITextInputAssistantItems

I've been working on a small app with a custom inputView and a custom inputAccessoryView.

One issue I experienced on iPad was this goofy bar sandwiched between both custom input views (pictured below).

Screenshot of my app with a goofy UITextInputAssistantItem bar

After some searching, I found out that those are UITextInputAssistantItems.

The app I’m working on has a unique and minimal amount of text input that is required. It doesn’t make sense to have undo, redo or copy & paste taking up so much screen real-estate.

I discovered that if you create a custom UITextField class and set both of the leadingBarButtonGroups and trailingBarButtonGroups to an empty array the UITextInputAssistantItem bar will disappear.

class CustomTextField: UITextField {

    init(frame: CGRect) {

        super.init(frame: frame)

        // remove undo/redo and copy/paste item bar on ipad
        inputAssistantItem.leadingBarButtonGroups = []
        inputAssistantItem.trailingBarButtonGroups = []
    }
}

Updated on Saturday, Feb. 15th 2020