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:
you have set contentmode
uiviewcontentmodescaleaspectfit
.
Comments
Post a Comment