1

I have an image which is completely red but there is a small line which is white in color and mid of the screen.But the line disappears as its getting downscaled I believe.

so if I my imageview width is 20 by 20.my 1x image should be 20* 20 and my 2x image should be 40 by 40 and my 3x image should be 60 by 60.

if I want to vector way then I can use pdf images which is of 20 by 20 and keep it 1x and it will be get scaled up to 40 for 2x and 60 for 3x.

Please correct me if I am wrong.

When I try to show image on bigger imageview of width and height as 300 by 200 then sometimes image gets stretched. how can I avoid that ? Have to maintain the image aspect ratio width and height w.r.t imageview.

I have heard using aspect fit content mode can solve the image stretch issue.

somebody please clarify me as other answers in stack overflow leads to bit more confusion.

Cheers

Rajan M
  • 345
  • 3
  • 22
  • 1
    Please learn it from here [UIImageView Content Mode](https://useyourloaf.com/blog/stretching-redrawing-and-positioning-with-contentmode/) – PPL May 22 '18 at 07:21
  • I will take a look into that thanks – Rajan M May 22 '18 at 07:24
  • 1
    yes, in all your imageView, set it to aspectFit and not aspectFill – William Loke May 22 '18 at 07:27
  • @WilliamLoke - oh Ok.Thanks but any reason as to why – Rajan M May 22 '18 at 07:30
  • 1
    for aspectFill - Scales the content to fill the size of the view. Some portion of the content may be clipped to fill the view’s bounds. As for aspectFit, it scales the content to fit the size of the view by maintaining the aspect ratio. Any remaining area of the view’s bounds is transparent. In other words, one keeps the aspect ratio – William Loke May 22 '18 at 07:33
  • @WilliamLoke - that's great thanks for letting me know – Rajan M May 22 '18 at 07:37

0 Answers0