iOS11 UITableview设置footer header高度不显示

代码如下设置但是iOS11上footer不显示(header同理)

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return kSixScaleWidth(8);
}

加上下面代码就行了

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

footer或header背景色设置

-(void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section
{
    view.tintColor = [UIColor clearColor];
}

注意

tableview 的类型设置为UITableViewStylePlain,不然高度为默认值。

设置footer后tableview会去掉多余分割线

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容