Reputation: 73
When the keyboard is shown, the UITableViewController in UIViewController automatically adjusts the contentInset.
So, I add this code in UITableViewController
if #available(iOS 11.0, *) {
self.tableView.contentInsetAdjustmentBehavior = .never
} else {
self.automaticallyAdjustsScrollViewInsets = false
}
But it does not work. How can I disable auto inset?
Upvotes: 0
Views: 4684
Reputation: 73
I found the perfect solution!
UITableView.appearance().contentInsetAdjustmentBehavior = .never
just add this code in UITableViewController. and strange adjust inset all gone!
Upvotes: 3
Reputation: 2741
Try to apply to the ViewController which contains the ContainerView (with the UITableView inside of it). It does not work when applied to the UITableView itself.
Or via code in viewDidLoad(): self.automaticallyAdjustsScrollViewInsets = false
Upvotes: 0