2

So in my scenario, I have a square that is (for understanding's sake) 100x100 and need to display an image that is 300x800 inside of it.

What I want to do is be able to have the image scale just as it would with UIViewContentMode.ScaleAspectFill so that the width scales properly to 100.

However, after that, I would like to then "move" the image up to the top of the image instead of it putting it inside the imageView right in the center, basically what UIViewContentMode.Top does. However that doesn't scale it first.

Is there anyway to do this type of behavior with the built in tools? Anyway to add multiple contentModes?

Drew S.
  • 516
  • 4
  • 19
  • 1
    [Here's a similar question](http://stackoverflow.com/questions/3272335/alignment-uiimageview-with-aspect-fit) that might help. – ama1111 Feb 14 '16 at 03:48
  • Thanks for the comment, I actually ended up just using a helper function that I wrote to scale the image to a size I need then I crop it based on the square rect. – Drew S. Feb 15 '16 at 11:29

1 Answers1

0

I already had a helper function that I wrote that scaled an image to a specific size passed in, so I just wrote a function that calculated the scaled image that would fit into the smaller square I had similar to the size AspectFill would do, and then I wrote code that would crop it with the rectangle size I needed at (0,0).

Drew S.
  • 516
  • 4
  • 19