用Xcode9 调试项目时,发现了下面这个问题:

解决办法:
iOS11弃用了automaticallyAdjustsScrollViewInsets属性,新增contentInsetAdjustmentBehavior来替代它

//声明tableView的位置 添加下面代码
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
_tableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
_tableView.scrollIndicatorInsets = _tableView.contentInset;
}
网友评论