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

提示:

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]];
}

你可能感兴趣的:(iOS错误崩溃总结)