Did XCode 6.3 / Swift 1.2 add additional margins to a UITableViewCell\'s contentView? Prior to updating, I had a custom UIView that extended all the way across the screen in
Look carefully at this screen shot of the Size inspector for a leading constraint:
See how "Relative to margin" is checked? That's your problem. If the margin changes, your left edge changes. Uncheck that menu item and then change the Constant to zero. Do that for the trailing constraint too, and your problems will be over.
Now let's address the deeper issue: what changed? You are absolutely right, something did. I believe they fixed a bug, and you got caught in the fix. Logging shows me that the cell's preservesSuperviewLayoutMargins
is true
and that the table's margins are 0,16,0,16
. This is true even on iOS 8.2, so the effective margins on iOS 8.2 should have been 16. But they were 8, as if preservesSuperviewLayoutMargins
were false
. But in iOS 8.3, this setting is obeyed properly — with the result that you have observed.
Thus, another way to fix the problem would have been to leave your constraints as they are, but to set each cell's preservesSuperviewLayoutMargins
to false
in cellForRowAtIndexPath:
. This works equally well to make the outcome identical in both systems.
EDIT Good news: it looks like this change is reverted in iOS 9. Thus, without change, your cells would look the same in iOS 9 as they did in iOS 8.2 and before.