美文网首页iOS开发
iOS11 UITableview设置footer header

iOS11 UITableview设置footer header

作者: 智人一千 | 来源:发表于2019-07-22 11:25 被阅读0次

代码如下设置但是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会去掉多余分割线

相关文章

网友评论

    本文标题:iOS11 UITableview设置footer header

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