fatuhoku
fatuhoku

Reputation: 4911

In Xcode 6 beta 5, setting auto-layout constraints as placeholders doesn't seem to work?

Whenever you do not provide autolayout constraints in Interface Builder, constraints are automatically created for you when you run the application.

I want to use Masonry to manage my own constraints, but the ones in storyboard are getting in the way.

The solution to this in Xcode 5 used to be that you can explicitly say that the auto-layout constraints are set to Placeholder / removed at build time, an option you can set in the Inspector:

screenie

But now in Xcode 6 beta 5 the screen looks like this:

screenie2

... and it's not clear to me what None does.

The worst thing is, it doesn't seem to remove any of the constraints, as you can see from the error!

What can I do in this case?

Upvotes: 2

Views: 938

Answers (2)

Tigger
Tigger

Reputation: 211

Here's how I fixed this in the Storyboard Editor in XCode 6: First set some nominal Top/Bottom/Left/Right constraints on the subview you want to remain unconstrained (I used "Spacing to nearest neighbour" and unticked "Constrain to margins", then click on each of those constraints individually, go to the Size Inspector, and tick Placeholder / Remove at build time. This means that Auto Layout still controls the entire nib but the specific subview doesn't have any constraints. After this I found I was able to programmatically change the size and origin of the subview without getting "Unable to simultaneously satisfy constraints: NSIBPrototypingLayoutConstraint" warning messages like I did before.

Upvotes: 1

mknecht
mknecht

Reputation: 11

I have the same problem. The placeholder constraints doesn't seam to work at all. I'm removing the NSIBPrototypingLayoutConstraint now before I'm adding any of my own.

if ([self.view.constraints count] > 0) {
    [self.view removeConstraints:self.view.constraints];
}

Upvotes: 1

Related Questions