MediaEditViewControllerOptions
@available(iOS 9.0, *)
@objcMembers
@objc(PESDKMediaEditViewControllerOptions)
open class MediaEditViewControllerOptions : NSObject
Options for configuring a MediaEditViewController
.
-
A configuration closure to configure the toolbars title view.
Declaration
Swift
public let titleViewConfigurationClosure: ViewConfigurationClosure?
-
The main view’s background color. Defaults to the configuration’s global background color.
Declaration
Swift
public let backgroundColor: UIColor?
-
The background color of the menu. Defaults to the configuration’s global background color.
Declaration
Swift
public let menuBackgroundColor: UIColor?
-
A configuration closure to configure the apply button displayed at the bottom right. Defaults to a checkmark icon.
Declaration
Swift
public let applyButtonConfigurationClosure: ButtonConfigurationClosure?
-
A configuration closure to configure the discard button displayed at the bottom left. Defaults to a cross icon.
Declaration
Swift
public let discardButtonConfigurationClosure: ButtonConfigurationClosure?
-
This closure allows further configuration of the action buttons. The closure is called for each action button and has the button and its corresponding action as parameters.
Declaration
Swift
public let actionButtonConfigurationClosure: ((MenuCollectionViewCell, PhotoEditMenuItem) -> Void)?
-
This closure is called every time the user selects a menu item.
Declaration
Swift
public let photoEditorActionSelectedClosure: ((PhotoEditMenuItem) -> Void)?
-
Controls if the user can zoom the preview image. Defaults to
true
.Declaration
Swift
public let allowsPreviewImageZoom: Bool
-
When set to
true
, the user is forced to crop the asset to one of the allowed crop aspects inTransformToolControllerOptions.allowedCropAspects
before being able to use other features of the editor. The transform tool will only be presented if the image does not already fit one of those allowed aspect ratios. It will be presented automatically, if the user changes the orientation of the asset and the result does not match an allowed aspect ratio. Defaults tofalse
.Attention
This property has no effect unlessTransformToolControllerOptions.allowFreeCrop
is set tofalse
.Declaration
Swift
public let forceCropMode: Bool
-
This closure allows further configuration of the overlay buttons. The closure is called for each button and has the button and its corresponding enum value as parameters.
Declaration
Swift
public let overlayButtonConfigurationClosure: ((OverlayButton, MediaEditOverlayAction) -> Void)?
-
Defines all allowed actions. Only buttons for allowed actions are visible. Defaults to show all available actions. To set this property from Obj-C, see the
allowedMediaEditOverlayActionsNSNumbers
property.Declaration
Swift
public let allowedMediaEditOverlayActions: [MediaEditOverlayAction]
-
This closure is called when the user selects an action.
Declaration
Swift
public let mediaEditOverlayActionSelectedClosure: ((MediaEditOverlayAction) -> Void)?
-
The undo/redo buttons in the
MediaEditViewController
have two different modes of operation: If this property istrue
(the default) each operation will be undone individually. So for example if you draw 3 strokes in the brush tool and move a sticker around twice in the sticker options tools, you’d have to tap ‘undo’ 5 times to undo everything. If this property isfalse
all modifications that have been made within a single tool will be grouped together and undone in one step. In the above example that means that you’d only have to tap ‘undo’ 2 times to undo everything (once for the changes within the sticker options tool and once for the changes within the brush tool).Declaration
Swift
public let undoStepByStep: Bool
-
If set this closure is called when the user taps the discard button while changes to the image are applied. You can for example use this to present an alert view informing the user that he is about to lose his changes. You have to call the passed closure when you have confirmation by the user to continue with program execution. By default it is set to present an
UIAlertController
.Declaration
Swift
public let discardConfirmationClosure: ((MediaEditViewController, @escaping () -> Void) -> Void)?
-
When a
MediaEditViewController
is part of a custom container view controller, which is presented in anUINavigationController
, theMediaEditViewController
will not be able to update the navigation controller’s navigation bar by default because that is the job of the immediate child of the navigation controller. Setting this property totrue
will update the parent view controller’s navigation item instead of its own navigation item to be able to use the navigation bar even when embedded in a custom container view controller. Default value isfalse
.Declaration
Swift
@available(*, deprecated, renamed: "navigationControllerMode", message: "Use `navigationControllerMode = .useNavigationBarAndParentNavigationItem` instead.") public var useParentNavigationItem: Bool { get }
-
This option defines the behavior if a
MediaEditViewController
or one of its ancestors is a child of aUINavigationController
. Default isNavigationControllerMode.useNavigationBar
.Declaration
Swift
public let navigationControllerMode: NavigationControllerMode
-
The insets used to layout the overlay buttons in their container. The
.top
value is ignored.Declaration
Swift
public let overlayButtonInsets: UIEdgeInsets
-
The menu items (or tools) to display in the main menu. Default is
PhotoEditMenuItem.defaultItems
.Declaration
Swift
public let menuItems: [PhotoEditMenuItem]
-
Creates a new instance of
MediaEditViewControllerOptions
using the given builder.Declaration
Swift
public init(builder: MediaEditViewControllerOptionsBuilder)
Parameters
builder
A
MediaEditViewControllerOptionsBuilder
instance.