I have a custom UITableViewCell
that contains only one UILabel
that holds a static text, I wrote two Autolayout
constraints in code (using the regular way but not visual format) to pin the leading and top edges of the label to the container view of the cell, and it works on both iOS 7
and iOS 8
devices but with a weird problem in iOS 8
: the top edge of the label is 12 pixels far from the top edge of the container view (and this is the correct and expected metrics) but in iOS 8
is more than that, about 20 pixels, and the same shifting happens for the leading edge of the label.
what does this means ? is that related to UIKit
changes between iOS 7
and iOS 8
for UITableViewCells
which now contains a hidden scrollView
in its hierarchy ?
p.s. the constraints are :
constraint = [NSLayoutConstraint constraintWithItem:self.myLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier: 1.0 constant:12];
[self.contentView addConstraint:constraint];
constraint = [NSLayoutConstraint constraintWithItem:self.myLabel attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeading multiplier:1.0 constant:12];
[self.contentView addConstraint:constraint];
any help would be highly appreciated ...