ios - Fit image to top of screen, fill width, keep aspect ratio -


so, i'm trying have "banner" @ top of viewcontroller. need image stay @ top of screen, full width of screen , keep aspect ration when doing so. i'm having hard time doing this. here tried:

  1. putting constraints on top, left , right of image view.
  2. make mode aspect fit

enter image description here

but how turns out:

enter image description here

anyone have idea how can force banner top , make keep aspect ratio well?

the problem still lack constraint. can add constraint such height, or aspect ratio. however, when add constraint aspect ratio, fill whole screen when in landscape. unless, you're using portrait, aspect ratio fine. if you're both using portrait , landscape, can use height constraint, , set content mode of image view aspect fit.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -