读书人

iOS UItableviewcell 点旋钮修改cell

发布时间: 2013-03-25 15:43:04 作者: rapoo

iOS UItableviewcell 点按钮修改cell颜色

@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;

读书人网 >操作系统

热点推荐