UIImageViewAligned for Xamarin.iOS

I came across a situation recently where I needed finer image layout options for a UIImageView in a Xamarin.iOS project. Specifically, I wanted something that could scale images with AspectFit but also force the image to the top of the UIImageView.

Luckily someone had already created a UIImageView subclass that solved all my problems and more. Only problem was that it was written in Objective-C. I found this snippet over in reyandro's github repos (specifically here).

Obviously it wasn't a tough port to C#, but I wanted to share it in case it saves anyone some time. Here's the port of the enumeration:

and then the UIImageView subclass:

Anyway, this has worked pretty well for me so far! Hope it saves someone the port time.