PhotoEditToolController
@objc(PESDKPhotoEditToolController) open class PhotoEditToolController: UIViewController, ToolbarItemProviding
A PhotoEditToolController
is the base class for any tool controllers. Subclass this class if you
want to add additional tools to the editor.
-
The render mode that the preview image should be rendered with when this tool is active.
Declaration
Swift
open var preferredRenderMode: PESDKRenderMode
-
The photo edit model that must be updated.
Declaration
Swift
open var photoEditModel = PhotoEditModel()
-
The unedited photo edit model without any changes applied.
Declaration
Swift
internal(set) public var uneditedPhotoEditModel = PhotoEditModel()
-
The configuration object that configures this tool.
Declaration
Swift
open let configuration: Configuration
-
The
delegate
for the tool controller.Declaration
Swift
internal(set) public weak var delegate: PhotoEditToolControllerDelegate?
-
The
UndoController
associated with this tool controller.Declaration
Swift
open var undoController: UndoController?
-
Creates a new photo edit tool controller with the given configuration.
Declaration
Swift
public required init(configuration: Configuration)
Parameters
configuration
The configuration options to apply.
Return Value
The initialized and configured photo edit tool controller object.
-
If set to
true
, the default preview view is used. If set tofalse
, the default preview view is hidden and you are responsible for displaying the image.Declaration
Swift
open var wantsDefaultPreviewView: Bool
-
The scale factor that should be applied to the main preview view when this tool is on top of the stack. Defaults to
nil
, which means that the zoom scale will be left untouched.Declaration
Swift
open var preferredDefaultPreviewViewScale: CGFloat
-
If set to
true
, scrolling in the default preview view is enabled while this tool is on top of the stack. Defaults tofalse
.Declaration
Swift
open var wantsScrollingInDefaultPreviewViewEnabled: Bool
-
The background color that should be used when this tool is active.
Declaration
Swift
open var preferredPreviewBackgroundColor: UIColor?
-
The insets that should be applied to the preview view when this tool is active.
Declaration
Swift
open var preferredPreviewViewInsets: UIEdgeInsets
-
The toolbar configuration item.
Declaration
Swift
fileprivate(set) open lazy var toolbarItem: ToolbarItem = DefaultToolbarItem()
-
Called when the photo edit model changes.
Declaration
Swift
open func photoEditModelDidChange()
-
Called when this tool wants zooming enabled. Override this method to setup a proxy scroll view for example.
Declaration
Swift
open func setupForZoomAndPan()
-
Called when this tool wants zooming enabled and is about to be presented. Override this method to reset your zoom scale if necessary.
Declaration
Swift
open func resetForZoomAndPan()
-
Whether the tool is currently active.
Declaration
Swift
private(set) open var isActiveTool = false
-
Notifies the tool controller that it is about to become the active tool.
Important
If you override this method, you must callsuper
at some point in your implementation.Declaration
Swift
open func willBecomeActiveTool()
-
Notifies the tool controller that it became the active tool.
Important
If you override this method, you must callsuper
at some point in your implementation.Declaration
Swift
open func didBecomeActiveTool()
-
Notifies the tool controller that it is about to resign being the active tool.
Note
This method will not be called if another tool is pushed above this tool. It is only called if you pop the tool from the toolbar controller.
Important
If you override this method, you must call
super
at some point in your implementation.Declaration
Swift
open func willResignActiveTool()
-
Notifies the tool controller that it resigned being the active tool.
Note
This method will not be called if another tool is pushed above this tool. It is only called if you pop the tool from the toolbar controller.
Important
If you override this method, you must call
super
at some point in your implementation.Declaration
Swift
open func didResignActiveTool()
-
Performs a model change without notifying the
delegate
.Declaration
Swift
open func performLocalModelChanges(_ changes: () -> Void)
Parameters
changes
The changes to apply to the model.
-
Whether a change to a model is local to the instance of
PhotoEditToolController
or not.Declaration
Swift
private(set) open var isModelChangeLocal = false