黑马程序员技术交流社区

标题: 设置tableview的cell颜色 [打印本页]

作者: zwcshy    时间: 2014-12-3 15:51
标题: 设置tableview的cell颜色
本帖最后由 zwcshy 于 2014-12-3 15:52 编辑
  1. //方法一:
  2. cell.contentView.backgroundColor = [UIColor redColor];
  3. //方法二:
  4. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  5. UIView* bgview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)];
  6. bgview.opaque = YES;
  7. bgview.backgroundColor = [UIColor orangeColor];
  8. [cell setBackgroundView:bgview];
  9. //方法三:
  10. - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
  11. {
  12. cell.backgroundColor = [UIColor redColor];
  13. }
复制代码







欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2