iOS11 UITableView 状态栏多出大小为20的空白区

2017-09-14  本文已影响70人  liuyihua的技术修炼场

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

image.png

解决办法:

iOS11弃用了automaticallyAdjustsScrollViewInsets属性,新增contentInsetAdjustmentBehavior来替代它

image.png
 //声明tableView的位置 添加下面代码
  if (@available(iOS 11.0, *)) {
        _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        _tableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
        _tableView.scrollIndicatorInsets = _tableView.contentInset;
}
上一篇 下一篇

猜你喜欢

热点阅读