Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Layout relative to margin warning XCode 6 but with no constraints

I have the dreaded warning Attribute Unavailable: Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0, but in my case, Margin does not appear in the storyboard, and the label in question (the one that is highlighted when I click on the warning) has no constraints. In fact, the entire view has no constraints.

I have seen other posts, eg. Attribute Unavailable warning on iOS versions prior to 8.0, but as I said no Margin to find, and no constraint to edit.

I will add constraints and hope it goes away, but it looks like another bug...

like image 207
Matt Avatar asked Sep 25 '14 22:09

Matt


People also ask

How do I add a layout constraint in Xcode?

To create constraints select the button and click the Align icon in the auto layout menu. A popover menu will appear, check both “Horizontal in container” and “Vertically in container” options to center the button on the screen. Then click the “Add 2 Constraints” button. Run the application.

What is constrain to margin in Xcode?

Basically if the layout margins are 8,8,8,8 (the default), a constraint with 0 leading space to container margin will have an x position of 8. Note that this is only available on iOS8 or later.

How do I fix misplaced view in Xcode?

You can correct this by pressing Command + Option + = or selecting "Update Frames" in the |-•-| menu (I think it looks like a tie fighter).


1 Answers

I think I've seen the same things for UILabels in Interface Builder. For me, the warning goes away by checking this box.

Preferred width

like image 120
mbo42 Avatar answered Sep 28 '22 12:09

mbo42