Why doesn't UITableViewCell background color work (set in interface builder)?

前端 未结 14 1859
青春惊慌失措
青春惊慌失措 2020-12-23 11:43

Why doesn\'t UITableViewCell background color work (set in interface builder)?

I note from some searching that the follow code set in your custom subclass of UITable

14条回答
  •  眼角桃花
    2020-12-23 11:56

    -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    UIView *view = [[UIView alloc] init];
    [view setBackgroundColor:[UIColor redColor]];
    [cell setSelectedBackgroundView:view];}
    

    We need to change the color in this method.

提交回复
热议问题