ios7 uitableviewcell图像左偏移

在iOS 6和更早的版本中,一个可用的viewview的imageView被定位在一个0偏移量的左边。 在iOS 7中,虽然这已经改变,现在有一个15点的空间。 我想定位imageview,就像它是在iOS 6中。我已经使用AKHighlightableAttributedCellinheritance了uitableviewcell来处理未被突出显示的属性文本。 所以基于一些search我补充说:

- (void) layoutSubviews { [super layoutSubviews]; // Makes imageView get placed in the corner self.imageView.frame = CGRectMake( 0, 0, 80, 80 ); } 

问题是一切还没有得到重新定位,所以我认为必须有一个更好的方式来做到这一点。 我读过一些人提到使用负偏移来移动所有的东西,但我不知道这是如何处理约束,因为它需要适当地缩放每个方向。 有没有更容易的解决scheme,我失踪了? 谢谢。

看来我是这样做的正确方法。 关于字段之间的分隔符的缺失部分是在iOS 7上设置插入。您可以在viewdidload或viewwillload中执行此操作,并设置self.tableView.separatorInset = UIEdgeInsetsMake(0,0,0,0);

如果运行iOS 7或更高版本,您将需要添加一个检查,因为这是一个新的属性,我相信。 一个更好的select可能是通过select表视图,然后设置从默认为自定义分隔符插入故事板。

这是layoutSubviews方法重新定位imageView和textLabel。 如果你有一个描述添加,以及。

 - (void) layoutSubviews { [super layoutSubviews]; // Makes imageView get placed in the corner self.imageView.frame = CGRectMake( 0, 0, 80, 80 ); // Get textlabel frame //self.textLabel.backgroundColor = [UIColor blackColor]; CGRect textlabelFrame = self.textLabel.frame; // Figure out new width textlabelFrame.size.width = textlabelFrame.size.width + textlabelFrame.origin.x - 90; // Change origin to what we want textlabelFrame.origin.x = 90; // Assign the the new frame to textLabel self.textLabel.frame = textlabelFrame; }