2011-09-06 52 views

回答

4

你应该为了做到这一点,因为实行的tableView委托方法是苹果recomendation。

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { 
    cell.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image.png"]]; 
} 

表视图,它使用 细胞之前绘制一排,从而允许委托其显示之前定制 细胞对象将此消息发送到它的委托。此方法为委托人提供了一个 机会来覆盖表 视图之前设置的基于状态的属性,例如选择和背景颜色。在代表 返回后,表视图仅设置alpha和frame属性,然后仅在行滑入或滑出时为其设置动画。

1
cell.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"myImage.png"]]; 
1

您可以创建一个图像作为背景的UIView,并将其添加到您的单元格中,然后您可以在UIView上添加其他控件和元素。