ios - How to configure the image or image view so that the image keeps its aspect ratio no matter what the size of the image view is? -


i put image view in static table view cell. image being stretched fit whole view. want image to:

  • be centered in image view
  • be in largest size possible but
  • not exceed bounds of image view and
  • keeps aspect ratio of image

first went docs of uiimageview. didn't find useful. looked @ docs of uiimage , found uiimageresizingmode. enum contains stretch , tile, not wanted. found this post told me to

logo.contentmode = .center 

but image still stretched. tried this

logo.contentmode = .scaleaspectfill 

but result same.

please tell me way this!

additional info:

the image view has following constraints:

enter image description here

you have set contentmode uiviewcontentmodescaleaspectfit.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -