RRCroppingView

Objective-C

@interface RRCroppingView : UIView

Swift

class RRCroppingView : UIView

A view providing cropping functionality for images. The user can fit the image using zooming and panning gestures. The cropped region is highlighted by a mask.

  • Initializer taking the image to interactively crop

    Declaration

    Objective-C

    - (instancetype _Nullable)initWithImage:(RRImage *_Nonnull)image;

    Swift

    init?(image: RRImage)

    Parameters

    image

    The image to crop using this view

  • Gets/Sets the image as the content of this view. This is the image that should be cropped.

    Declaration

    Objective-C

    @property (nonatomic, strong) RRImage *_Nullable image;

    Swift

    var image: RRImage? { get set }
  • Gets/Sets the color of the overlay that presents the part that is going to be cut away.

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *_Nonnull transparentOverlayColor;

    Swift

    var transparentOverlayColor: UIColor { get set }
  • Defines the behaviour of the view concerning whitespace within the cropped image region. Default is RRCroppingViewWhitespaceToleranceStrict.

    Declaration

    Objective-C

    @property (nonatomic) RRCroppingWhitespaceTolerance whitespaceTolerance;

    Swift

    var whitespaceTolerance: RRCroppingWhitespaceTolerance { get set }
  • Defines the aspect ratio of the cropping region.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat cropRegionAspectRatio;

    Swift

    var cropRegionAspectRatio: CGFloat { get set }
  • Gets/Sets the shape of the cropping mask. Currently a rectangular and an elliptical mask is possible.

    Declaration

    Objective-C

    @property (nonatomic) RRCroppingShape croppingShape;

    Swift

    var croppingShape: RRCroppingShape { get set }
  • Gets/Sets the padding between the border and the cropping region. The unit is in % of the views width in the rang of 0 (0 %) to 0.5 (50 %).

    Declaration

    Objective-C

    @property (nonatomic) CGFloat croppingMaskPadding;

    Swift

    var croppingMaskPadding: CGFloat { get set }
  • Gets/Sets the maximum allowed zoom level. This is defined as multiple of the cropping regions size. The default value is 2 (meaning that the image can be enlarged to twice the size of the cropping region).

    Declaration

    Objective-C

    @property (nonatomic) CGFloat maximumZoom;

    Swift

    var maximumZoom: CGFloat { get set }
  • Gets the cropped version of the original image defined by the current view state.

    Declaration

    Objective-C

    - (RRImage *_Nonnull)getCroppedImage;

    Swift

    func getCroppedImage() -> RRImage

    Return Value

    Cropped image