Something is up with our table view cell separators on the iPhone 6 Plus. I created a blank test project with a custom cell with only one label and a 15pt constraint to the leading edge.
iPhone 5S
Label and separator are 30 px (15pt) from the leading edge. All is good.
iPhone 6 Plus
Label is 48 px (15pt) from the leading edge and the separator is 60px (20pt) from the leading edge.
If i log the tableView.separatorInset it's 15pt on the iPhone 5S and 20pt on the 6 Plus. Setting the inset to 15 on the 6 Plus manually doesn't work.
Please send help.
Override layoutMargins method in your custom cell class.
- (UIEdgeInsets)layoutMargins
{
return UIEdgeInsetsMake(0, 15, 0, 0);
}
If you are using a Storyboard, select the Table View attributes inspector. Change the
Separator Inset
to
Custom
and leave the default left margin as 15
.
Not a perfect solution, but it worked for me.
@IBOutlet weak var leftViewLeadingConstraint: NSLayoutConstraint!
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
switch UIScreen.mainScreen().scale {
case 2:
leftViewLeadingConstraint.constant = 7.0
case 3:
leftViewLeadingConstraint.constant = 11.0
default:
assertionFailure("Error: wrong scale value")
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With