怎样在ios开发中设置tableview的cell颜色

来源:互联网 发布:tensorflow 图像分割 编辑:程序博客网 时间:2024/04/29 13:52


//方法一:
cell.contentView .backgroundColor = [ UIColor redColor ];
//方法二:
UITableViewCell*cell = [tableView dequeueReusableCellWithIdentifier :CellIdentifier];
UIView* bgview = [[ UIView alloc ] initWithFrame :CGRectMake( 0 , 0, 1, 1)];
bgview.opaque = YES;
bgview.backgroundColor = [ UIColor orangeColor ];
[cellsetBackgroundView :bgview];
//方法三:
- ( void )tableView:( UITableView *)tableView willDisplayCell :( UITableViewCell *)cell forRowAtIndexPath :( NSIndexPath *)indexPath
{
cell.backgroundColor = [ UIColor redColor ];
}

0 0
原创粉丝点击