UIView `readableContentGuide` in the Builder interface?

iOS 9 readableContentGuide is a UILayoutGuide (essentially what you can associate with restrictions) that all UIViews have. The idea is to keep subviews with text too wide on the iPad in the landscape.

It is easy to configure this in code ( v1 is the subview, v is its supervisor):

 NSLayoutConstraint.activateConstraints([ v1.topAnchor.constraintEqualToAnchor(v.readableContentGuide.topAnchor), v1.bottomAnchor.constraintEqualToAnchor(v.readableContentGuide.bottomAnchor), v1.rightAnchor.constraintEqualToAnchor(v.readableContentGuide.rightAnchor), v1.leftAnchor.constraintEqualToAnchor(v.readableContentGuide.leftAnchor) ]) 

Now. So far, so good. However ... Two different WWDC videos claim that you can customize the binding of the preview to its readableContentGuide supervision in Interface Builder.

But they do not explain how you do it.

So my question is: how do you do this?

+7
xcode interface-builder
source share
1 answer

As usual, snap the edges of the subview to the fields of the supervisor.

Now, in the supervisor size inspector, select the "Follow Readable Width" checkbox:

enter image description here

+11
source share

All Articles