Readable Content Guide changes in iOS 11?

I'm trying to wrap my head around the readable content guide has changed (or didn't change) in iOS 11.


In iOS 10, I constrained content inside of a table view to the readable guide. In iOS 11, I was a bit surprised to see that the content is now further from the edge of the screen.


Trying to simplify it down to a test case in a sample project in Xcode 9... I put some UIButtons in table view cells. The leading constraint is equal to the superview's leading margin. The Table View Cell's contentView has both "Follow Readable Width" and "Safe Area Relative Margins" checked.


What I'm seeing on iOS 11 is this:



The frame of the Button is (16 6; 46 30). When I run the same project in the iOS 10 Simulator, I get



The button frame here is (8 6; 46 30). So, it's 8 points closer to the edge of the screen.


What I'm wondering is how to work with this. I'm not sure that it's a bug (I'll file one anyway, since I'm confused), and I thought perhaps the safe area had something to do with it. But if I uncheck the Safe Area option in my Storyboard, there's no change in iOS 11.


It seems like if I want to achieve the same layout in both iOS 10 and iOS 11 I'm going to have to make a bunch of constraint adjustments in code that only runs on iOS 10.

Replies

Here's a note I got back from Apple engineering after filing a bug:


This issue behaves as intended based on the following:

In iOS 11, table view cells and their contentView always preserves superview layout margins on the left & right edges. This results in the behavior observed where constraints to the layout margins of the contentView will result in an inset matching the default layoutMargins on the table view.

Before iOS 11, you had to manually enable this behavior via the preservesSuperviewLayoutMargins property on UIView, or the “Preserves Superview Margins” checkbox in the Size inspector of Interface Builder for any view. In the sample project, if you check this box for the UITableViewCell and the Content View inside it, you should see consistent behavior on iOS 11 and on earlier releases.