关于tableview顶部留白问题

2018-03-08  本文已影响34人  Luyc_Han
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];

上一篇 下一篇

猜你喜欢

热点阅读