美文网首页
iOS11 UITableView 状态栏多出大小为20的空白区

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

作者: liuyihua的技术修炼场 | 来源:发表于2017-09-14 13:40 被阅读70次

用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;
}

相关文章

网友评论

      本文标题:iOS11 UITableView 状态栏多出大小为20的空白区

      本文链接:https://www.haomeiwen.com/subject/fmxdsxtx.html