Milky
Milky

Reputation: 33

How to show Image in full screen?

I’m trying to make simple meme app using Swift.I need to set up image at full screen.You can see Main StoryBoard with constraints here. But when im picking image that must fill full screen in portrait as result there is blank spaces in top and bottom. Similarly with landscape image but now spaces are on right and left. Anyone know how to fix this?

Upvotes: 2

Views: 4418

Answers (2)

user7219266
user7219266

Reputation:

You can also implement a very handy third party library, easy to use : https://github.com/JanGorman/Agrume

It enables you to handle every kind of gestures, interactions, zooms etc.. on your UIImageView. Thus, you won't have to worry about portrait/landscape constraints.

@Ashley Mills answer is the answer, mine is just an advice.

Upvotes: 1

Ashley Mills
Ashley Mills

Reputation: 53121

Set your UIImageView's contentMode to aspectFill.

Either in the storyboard…

enter image description here

or in code…

imageView.contentMode = .aspectFill

Upvotes: 2

Related Questions