Search code examples
iosswiftuitableviewios12

UITableView does not scroll when keyboard appears


UITableView does not auto-scroll when a UITextField/UITextView becomes the first responder. It used to work just fine on iOS 9-11, but now it doesn't work anymore on iOS 12.
What should I set up or change in the tableView to fix the behavior?

Reference GIF

enter image description here


Solution

  • I found solution in the code, as you said. This part of code was blame:

    if #available(iOS 11.0, *) {
        tableView.contentInsetAdjustmentBehavior = .never
    } else {
        automaticallyAdjustsScrollViewInsets = false
    }