美文网首页
tableview模版自定义willDisplayCell改变t

tableview模版自定义willDisplayCell改变t

作者: 高高叔叔 | 来源:发表于2017-05-23 14:04 被阅读72次

    在- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath代理方法中修改textLabel和detailTextLabel的背景颜色,不会马上生效。
    下面的代理方法设置,界面效果会马上响应,亲测可行:

    - (void)tableView: (UITableView*)tableView willDisplayCell: (UITableViewCell*)cell forRowAtIndexPath: (NSIndexPath*)indexPath
    {
            cell.textLabel.textAlignment = 1;
            cell.accessoryType = UITableViewCellAccessoryNone;
            cell.textLabel.textColor = [UIColor redColor];
            [ cell.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.center.equalTo(cell);
            }];
    }
    

    相关文章

      网友评论

          本文标题:tableview模版自定义willDisplayCell改变t

          本文链接:https://www.haomeiwen.com/subject/sjawxxtx.html