美文网首页
关于tableview顶部留白问题

关于tableview顶部留白问题

作者: Luyc_Han | 来源:发表于2018-03-08 19:51 被阅读34次
image.png

在隐藏导航栏的情况下设置

        self.tableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];

    if (@available(iOS 11.0, *)){
        
        self.tableview.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        
    }else {
    
        self.automaticallyAdjustsScrollViewInsets = NO;
        
    }

注:

contentInsetAdjustmentBehavior是UIScrollView的属性所以应该是UIScrollView顶部留白问题

或者设置
[[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];

相关文章

网友评论

      本文标题:关于tableview顶部留白问题

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