Boon
Boon

Reputation: 41510

Autolayout for UIImageView in storyboard without image

I have an UIImageView in storyboard that has no image set. I don't want the width to be set at design time, but rather have the image assigned to it at runtime drive the intrinsic content size but storyboard gives me a constraint error on missing constraint. What should I do to get rid of that?

Upvotes: 3

Views: 282

Answers (1)

vacawama
vacawama

Reputation: 154711

Add a width constraint to the UIImageView and then in the Size inspector, click the box next to Placeholder Remove at build time:

Placeholder constraint

This Placeholder constraint will satisfy Interface Builder, but it will be removed at build time and not get in the way at runtime.

Upvotes: 5

Related Questions