All custom UITableViewCells
which are compiled under iOS11 (Xcode 9) are getting an extra leading margin but not with iOS10 (Xcode 8). Please see the images.
iOS 10, compiled with Xcode 8
iOS 11, compiled with Xcode 9
How to get the iOS 10 behavior for devices with iOS 11 too.
I was able to solve this problem using the answer to UITableViewCell with autolayout left margin different on iPhone and iPad. Setting “Preserve Superview Margins” on both the table view cell and the content view it contains resolved the inconsistency between rendering in iOS 10 and iOS 11.
Another workaround, in the opposite direction (i.e. having the same behaviour you had in iOS 10), would be to set preservesSuperviewLayoutMargins
to false in the cell and the content view of your cell. For example, in you UITableViewCell
subclass:
override func awakeFromNib() {
super.awakeFromNib()
preservesSuperviewLayoutMargins = false
contentView.preservesSuperviewLayoutMargins = false
}
This way you recover the iOS 10 behaviour.
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