CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

Julian Raschke

1pod

JLNRGravityImageView

This lightweight UIImageView subclass controls how images are clipped in AspectFill content mode.

By default, UIImageView centres the image, but JLNRGravityImageView can define the ‘gravity’ so that only one side of the image is trimmed off.

This is useful, for example, if you want to avoid clipping off the top of a photo because faces are more interesting than shoes.

For the curious, this is implemented by adjusting the CALayer’s contentsRect property.

License: MIT

  • Objective C