Skip to content

Latest commit

 

History

History
44 lines (24 loc) · 1004 Bytes

File metadata and controls

44 lines (24 loc) · 1004 Bytes

TableViewInsets

Conform to this protocol and when the keyboard comes up your tableviews' insets will be adjusted and it won't be covered up by the keyboard!

1. Conform

class ExampleTableViewController: UITableViewController, TableViewInsetsAdjusting {

2. Call setup (free function after you conform to TableViewInsetsAdjusting)

override func viewDidLoad() {
    super.viewDidLoad()
    setupInsetAdjust()
}

3. Call takeDown (free function after you conform to TableViewInsetsAdjusting)

deinit {
    takeDownInsetAdjust()
}

Here it is all together:

class ExampleTableViewController: UITableViewController, TableViewInsetsAdjusting {

  override func viewDidLoad() {
    super.viewDidLoad()
    setupInsetAdjust()
  }
  
  deinit {
    takeDownInsetAdjust()
  }

}

Here's a blog post about it: CheckoutMyCode