出现键盘时,UITableView不滚动

时间:2018-10-10 08:47:45

标签: ios swift uitableview ios12

当UITextField / UITextView成为第一响应者时,

UITableView不会自动滚动。过去在iOS 9-11上可以正常使用,但现在在iOS 12上不再可以使用了。
我应该在tableView中进行什么设置或更改才能解决此问题?

参考GIF

enter image description here

1 个答案:

答案 0 :(得分:5)

正如您所说,我在代码中找到了解决方案。这部分代码是罪魁祸首:

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