首页 > iPhone6 Plus中UITableViewCell 中的textLabel的frame被改变了

iPhone6 Plus中UITableViewCell 中的textLabel的frame被改变了

在6+中cell的textLabel会被cell的layoutSubView改变frame(x从原来的15变成了20),虽然可以通过不调用[super layoutSubviews];来防止被改变,但是这样之后,如果是带有image的cell,imageview的大小会变成1,1, 只能手动来设置subviews的位置了。那么问题来了,能不能又别的办法让cell的layout不改变textLabel的位置


试试在 cell 加载的时候把 contentView 的规则都干掉试试?

代码:

[self.contentView removeConstraints:self.contentView.constraints];

然后自己写规则:

- (void)updateConstraints
{
  [super updateConstraints];
  [self.contentLabel autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsMake(kLabelVerticalInsets, kLabelHorizontalInsets, kLabelVerticalInsets, kLabelHorizontalInsets)];
}

我觉得这样可控性更高

【热门文章】
【热门文章】