5

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

LinusGeffarth
  • 27,197
  • 29
  • 120
  • 174
Ruslan
  • 141
  • 5
  • The question is what *have* you setup so far? We need a little more detail to be able to help. – LinusGeffarth Oct 10 '18 at 08:49
  • Without code how can other helps you? – Denis Oct 10 '18 at 08:50
  • Is this not default behavior of UITableView? – Ruslan Oct 10 '18 at 08:54
  • No, you need handle that manually. However, there's libraries like [KeyboardLayoutConstraint.swift](https://github.com/MengTo/Spring/blob/master/Spring/KeyboardLayoutConstraint.swift) that take care of keyboard events where you can setup contraints. – LinusGeffarth Oct 10 '18 at 08:58
  • @Ruslan, have you set the content-inset properly when the keyboard appears? if no, why not? – holex Oct 10 '18 at 09:05
  • hmm, probably this is default behavior not tableView but UITableViewController? What do you think about this? https://medium.com/@how_noobs_think/uitableviewcontroller-will-automatically-adjust-content-position-relative-to-keyboard-ios-swift-8810a375ffb2 – Ruslan Oct 10 '18 at 09:06
  • Looks like that's the case, yes. Can't confirm, though. – LinusGeffarth Oct 10 '18 at 09:08

1 Answers1

9

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
}
LinusGeffarth
  • 27,197
  • 29
  • 120
  • 174
Ruslan
  • 141
  • 5