3

I have an UIImageView with aspect fit.

The UIImage is always centered in the UIImageView, how can i make the image placed to the left? I can't find any settings. Is there any workaround?

Lord Vermillion
  • 5,264
  • 20
  • 69
  • 109
  • As far as i know, it can't be done with only UIImageView. This may help [link](http://stackoverflow.com/questions/18626816/how-to-set-the-uiimageview-align-left-or-right-when-set-the-contentmode-to-uivie) – Suttikeat Witchayakul Oct 20 '15 at 08:54

2 Answers2

1

Here is a good example using which you can achieve what you are trying to achieve.

It is a subclass of UIImageView that allows you to customize the alignment of the displayed image inside the view's frame. This works even if the contentMode is set to AspectFit, AspectFill or ScaleToFill.

iAnurag
  • 9,286
  • 3
  • 31
  • 48
-4

try imageView.contentMode = UIViewContentModeLeft;

Deslim Lim
  • 118
  • 4