TransformEditController

@available(iOS 9.0, *)
@objcMembers
@objc(PESDKTransformEditController)
open class TransformEditController : ViewController
extension TransformEditController: ScalePickerDelegate
extension TransformEditController: CropAndStraightenViewDelegate
extension TransformEditController: UIGestureRecognizerDelegate
extension TransformEditController: PhotoPreviewControlling

A TransformEditController displays controls and provides gestures to edit the straighten angle, crop rectangle and orientation of an image.

State Properties

  • Whether or not controls (e.g. straighten angle picker, flip button, rotate button, crop handles) should be shown. Default is true. This must be set before the view is loaded or it won’t have any effect.

    Declaration

    Swift

    open var showControls: Bool
  • Whether or not the straighten angle can be set using a rotation gesture. Default is false. This must be set before the view is loaded or it won’t have any effect.

    Declaration

    Swift

    open var canRotateUsingGesture: Bool

LocalPhotoEditModelSettable

Views

Configuration

  • The rotation recognizer that updates the straighten angle based on rotation gestures.

    Declaration

    Swift

    open private(set) var rotationGestureRecognizer: UIRotationGestureRecognizer? { get }

Scale Picker Area

  • The container view for the scale picker.

    Declaration

    Swift

    open private(set) lazy var scalePickerContainerView: MenuAccessoryContainerView { get set }
  • The scale picker view.

    Declaration

    Swift

    open private(set) lazy var scalePicker: ScalePicker { get set }
  • The button to flip the image.

    Declaration

    Swift

    open private(set) lazy var flipButton: Button { get set }
  • The button to rotate the image.

    Declaration

    Swift

    open private(set) lazy var rotateButton: Button { get set }
  • The gradient layer that is added above the scale picker.

    Declaration

    Swift

    open private(set) lazy var gradientLayer: CAGradientLayer { get set }

State

  • The currently active crop rectangle in view coordinates.

    Declaration

    Swift

    open var viewCropRect: CGRect { get set }
  • Updates the crop rectangle in view and normalized image dimensions.

    Declaration

    Swift

    open func setViewCropRect(_ viewCropRect: CGRect, normalizedImageRect: CGRect, animated: Bool = false)

    Parameters

    viewCropRect

    The crop rectangle in view dimensions.

    normalizedImageRect

    The crop rectangle in normalized image dimensions.

    animated

    Whether to animate this change.

  • The currently set straighten angle.

    Declaration

    Swift

    open var straightenAngle: CGFloat { get set }
  • Updates the straighten angle.

    Declaration

    Swift

    open func setStraightenAngle(_ straightenAngle: CGFloat, animated: Bool, completion: (() -> Void)? = nil)

    Parameters

    straightenAngle

    The straighten angle.

    animated

    Whether to animate this change.

    completion

    A closure to execute after the angle changed.

Crop Aspect

  • The currently set CropAspect.

    Declaration

    Swift

    open var cropAspect: CropAspect? { get set }
  • Sets the crop aspect.

    Declaration

    Swift

    open func setCropAspect(_ cropAspect: CropAspect?, animated: Bool)

    Parameters

    cropAspect

    The crop aspect or nil for a free transform.

    animated

    Whether to animate this change.

  • This is a boxed property which exposes a Swift struct to Objective-C. This property should only be used if you are using Objective-C.

    Every invocation of the getter will return a new (temporary) object wrapping the underlying Swift struct. Boxed properties cannot be chained with the dot syntax for mutable access of nested properties in place. Use the setter with the assignment operator instead to modify boxed properties, e.g.:

    PESDKPhotoEditModel *photoEditModel = [[PESDKPhotoEditModel alloc] init];
    
    // CORRECT:
    // get boxed `AdjustmentModel`
    PESDKAdjustmentModel *adjustmentModel = photoEditModel.adjustmentModel;
    // modify boxed `AdjustmentModel`
    adjustmentModel.brightness = 0.5;
    // set modified boxed `AdjustmentModel`
    photoEditModel.adjustmentModel = adjustmentModel;
    
    // WRONG:
    photoEditModel.adjustmentModel.brightness = 0.5;
    

    Declaration

    Swift

    var boxedPhotoEditModel: _ObjCPhotoEditModel { get set }