SBSDKImageEditingViewController

@interface SBSDKImageEditingViewController : UIViewController

A UIViewController subclass to show and edit an image. The user can move edge and corner handlers to redefine the polygon manually and rotate the image in 90 degree steps (counter) clockwise. This class cannot be instanced from a storyboard. Instead it is installing itself as a child view controller onto a given parent view controller.

  • The uncropped input image. If polygon is nil, the receiver tries to detect and set a polygon from the image. Must be called on the main-thread!

    Declaration

    Objective-C

    @property (nonatomic, strong, nonnull) UIImage *image;

    Swift

    var image: UIImage { get set }
  • The current polygon. If nil, the default, fully enclosing, polygon is used. Must be called on the main-thread!

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) SBSDKPolygon *polygon;

    Swift

    @NSCopying var polygon: SBSDKPolygon? { get set }
  • The number of clockwise rotations.

    Declaration

    Objective-C

    @property (nonatomic) NSInteger rotations;

    Swift

    var rotations: Int { get set }
  • The rendering color of non-snapped edges. Must be called on the main-thread!

    Declaration

    Objective-C

    @property (nonatomic, strong, nonnull) UIColor *edgeColor;

    Swift

    var edgeColor: UIColor { get set }
  • The rendering color of magnetically snapped edges. Must be called on the main-thread!

    Declaration

    Objective-C

    @property (nonatomic, strong, nonnull) UIColor *magneticEdgeColor;

    Swift

    var magneticEdgeColor: UIColor { get set }
  • The color of anchor points. The default value is nil, which means that anchors will be white. Must be called on the main-thread!

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *anchorPointsColor;

    Swift

    var anchorPointsColor: UIColor? { get set }
  • The width of the edges. The default value is 2. Must be called on the main-thread!

    Declaration

    Objective-C

    @property (nonatomic) CGFloat edgeLineWidth;

    Swift

    var edgeLineWidth: CGFloat { get set }
  • The cropped and rotated image. This is the final result of the receiver. Must be called on the main-thread!

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) UIImage *croppedImage;

    Swift

    var croppedImage: UIImage? { get }
  • Enables or disables crop functionality. Default is YES.

    Declaration

    Objective-C

    @property (nonatomic, getter=isCropEnabled) BOOL cropEnabled;

    Swift

    var isCropEnabled: Bool { get set }
  • Enables or disables rotation functionality. Default is YES.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isRotationEnabled) BOOL rotationEnabled;

    Swift

    var isRotationEnabled: Bool { get set }
  • The insets of the contents: image and handles. Defaults to (12, 12, 12, 12).

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets contentInsets;

    Swift

    var contentInsets: UIEdgeInsets { get set }
  • Delegate for result callback methods.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<SBSDKImageEditingViewControllerDelegate> delegate;

    Swift

    weak var delegate: SBSDKImageEditingViewControllerDelegate? { get set }
  • Designated initializer. Installs the receiver as child view controller onto the parent view controllers view using its entire bounds area.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithParentViewController:
                                (nonnull UIViewController *)parentViewController
                                           containerView:
                                               (nonnull UIView *)container;

    Swift

    init(parentViewController: UIViewController, containerView container: UIView)

    Parameters

    parentViewController

    The view controller the newly created instance is embedded into.

    container

    The view to embed the receivers view into. Must be a descendant of parentViewControllers view.

  • Asks the controller to rotate input image

    Declaration

    Objective-C

    - (void)rotateInputImageClockwise:(BOOL)clockwise animated:(BOOL)animated;

    Swift

    func rotateInputImageClockwise(_ clockwise: Bool, animated: Bool)

    Parameters

    clockwise

    The rotation direction. If set YES, rotates clockwise, counterclockwise otherwise.

    animated

    If set to YES, animates the rotation.

  • Updates the navigation bars buttons of the receiver by calling the appropriate delegate functions.

    Declaration

    Objective-C

    - (void)updateNavigationBarItems;

    Swift

    func updateNavigationBarItems()
  • Updates the toolbars buttons of the receiver by calling the appropriate delegate functions.

    Declaration

    Objective-C

    - (void)updateToolBarItems;

    Swift

    func updateToolBarItems()
  • Tells the receiver to apply changes immediately. Calls the appropriate delegate method when finished.

    Declaration

    Objective-C

    - (void)applyChanges;

    Swift

    func applyChanges()
  • Tells the receiver to cancel changes immediately. Calls the appropriate delegate method.

    Declaration

    Objective-C

    - (void)dismissChanges;

    Swift

    func dismissChanges()