美文网首页
UITableViewHeaderFooterView 背景颜色

UITableViewHeaderFooterView 背景颜色

作者: 指尖_跳舞 | 来源:发表于2020-01-05 10:29 被阅读0次

改变全部tableview 的headerfooterview背景颜色 通过各种尝试 运行时基类调用
-(void)tableView:(UITableView*)tableView willDisplayFooterView:(UIView*)view forSection:(NSInteger)section{view.backgroundColor=[UIColor clearColor];}

-(void)tableView:(UITableView*)tableView willDisplayFooterView:(UIView*)view forSection:(NSInteger)section{UITableViewHeaderFooterView*footer=(UITableViewHeaderFooterView*)view;footer.contentView.backgroundColor=[UIColor redColor];}

等无效。

使用:

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

基类中获取tableview(统一设置tablefooterview 避免多余的分割线)避免获取不到报错 实现方法:
-(id)valueForUndefinedKey:(NSString *)key{

    NSLog(@"出现异常,该key不存在%@",key);

    return nil;

}

相关文章

网友评论

      本文标题:UITableViewHeaderFooterView 背景颜色

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