Reputation: 81
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 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 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
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