haohao
haohao

Reputation: 81

How do I set the proper UIImageView in Xcode storyboard?

I am making an app which will take a photo and crop the photo to a square or a 4*3 image.

And then when I click the Next button, I will enter the Post view

(Just like Instagram)

The Post View

The UIImageView will show the photo what I take from last view.


The question is how can I set the UIImageView to a square or 4*3 image

and make it's right and left side fill the screen?

If I manually set the same width and height to fill the border of storyboard, it will look like this The UITextView is being blocked

The UIImageView will block the UITextView.

The storyboard will have no space to add other UITextViews

Should I set the UIImageView through code or other ways?

Upvotes: 1

Views: 636

Answers (1)

Adam H.
Adam H.

Reputation: 680

Set its left edge constraint to the left side, its right edge constraint to the right side, its top edge constraint to the top side, then set its aspect ratio. Its height will then be determined based off of the width of the screen. Most things that seem daunting with Autolayout are actually quite easy. It is an incredibly powerful tool.

Upvotes: 1

Related Questions