tableview模版自定义willDisplayCell改变字体颜色

来源:互联网 发布:vep视觉训练软件 编辑:程序博客网 时间:2024/05/16 16:07

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath代理方法中修改textLabel和detailTextLabel的背景颜色,不会马上生效。

下面的代理方法设置,界面效果会马上响应,亲测可行:

- (void)tableView: (UITableView*)tableView willDisplayCell: (UITableViewCell*)cell forRowAtIndexPath: (NSIndexPath*)indexPath

{

    cell.backgroundColor = [UIColor blackColor];

    cell.textLabel.backgroundColor = [UIColor redColor];

    cell.detailTextLabel.backgroundColor = [UIColor blueColor];

}

- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)sectionNS_AVAILABLE_IOS(6_0);

- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)sectionNS_AVAILABLE_IOS(6_0);



0 0
原创粉丝点击