Setting the background color on UITableViewHeaderFooterView has been deprecated. Please use contentV

来源:互联网 发布:数据帧长度 原因 编辑:程序博客网 时间:2024/05/16 13:47

提示:

Setting the background color on UITableViewHeaderFooterView has been deprecated. Please use contentView.backgroundColor instead.


当时设置tableView组头视图的颜色时写法如下

- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section{    view.backgroundColor = [UIColor lightGrayColor];}

这种设置组头视图背景颜色的方法已经被摒弃了


正确写法:

- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section{    UITableViewHeaderFooterView *headerView=(UITableViewHeaderFooterView *)view;    [headerView.backgroundView setBackgroundColor:[UIColor lightGrayColor]];}
阅读全文
0 0
原创粉丝点击