`TableViewInsetsAdjusting` to the rescue!
final class ExampleTableViewController: UITableViewController, TableViewInsetsAdjusting {
private var inputBar: TextInputBar = TextInputBar.viewFromNib()
override func viewDidLoad() {
super.viewDidLoad()
setupInsetAdjust()
}
override func canBecomeFirstResponder() -> Bool {
return true
}
override var inputAccessoryView: UIView? {
return inputBar
}
deinit {
takeDownInsetAdjust()
}
}
|
Just conform to TableViewInsetsAdjusting, call `setupInsetAdjust` and you'll have your insets adjusting automatically for you whenever the keyboard comes up.
Don't forget to call `takeDownInsetAdjust` on your way out.
No comments:
Post a Comment