Add UIToolBar to all keyboards (swift)

后端 未结 5 1577
[愿得一人]
[愿得一人] 2021-01-31 05:19

I\'m trying to add a custom UIToolBar to all of my keyboards with as little repetition. The way I\'m currently doing it requires me to add the code to all my viewDidLoads and as

5条回答
  •  佛祖请我去吃肉
    2021-01-31 06:03

    I have an utility that I've been using some time (ported to Swift from Objective-C) that does this and a little more, you might find it useful:

    https://github.com/ncerezo/SwiftKeyboardAccessory

    It creates a toolbar with at least a "Done" button to dismiss the keyboard, and optionally Next and Previous buttons. It also takes care of dismissing the keyboard when you tap outside the text field, and of resizing and scrolling the view when the keyboard appears or disappears. It's designed to work with UITableVIew and also with UIScrollView.

提交回复
热议问题