1. 程式人生 > >ios11適配

ios11適配

1.iOS11下必須加那兩個方法,否則不走表頭表尾高度設定方法的

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView *footView = [[UIView alloc]init];
    return footView;
}
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *headerView = [[UIView alloc]init];


    return headerView;
}

2.ios11不走self.automaticallyAdjustsScrollViewInsets = NO;

需要設定:

if (@available(iOS 11.0, *)) {
        tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    } else {
        // Fallback on earlier versions
    }