@interface MyTableViewController : UITableViewController {
UIColor *cellColor;
}
-(IBAction)click:(id)sender;
@implementation MyTableViewController
-(IBAction)click:(id)sender{
cellColor = [uicolor redcolor];
[self.tableview reloaddata];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Setup your cell
cell.textLabel.backgroundColor = [uicolor clearcolor];
cell.detailTextLabel.backgroundColor = [uicolor clearcolor];
cell.accessoryView.backgroundColor = [uicolor clearcolor];
cell.contentView.backgroundColor = cellColor;
return cell;
}
@end
.
cell.backgroundView = [[[uiview alloc] init] autorelease];
cell.backgroundView.backgroundColor = self.cellColor;