CropAndStraightenView
@available(iOS 9.0, *)
@objcMembers
@objc(PESDKCropAndStraightenView)
open class CropAndStraightenView : UIView
extension CropAndStraightenView: UIScrollViewDelegate
extension CropAndStraightenView: UIGestureRecognizerDelegate
extension CropAndStraightenView: GLKViewDelegate
extension CropAndStraightenView: MTKViewDelegate
The CropAndStraightenView
class provides support for displaying, zooming, rotating and
cropping an image.
-
A
SpriteContainerView
which contains all sprites that have been added.Declaration
Swift
open var spriteContainerView: SpriteContainerView? { get set }
-
The delegate of the
CropAndStraightenView
object.Declaration
Swift
open weak var delegate: CropAndStraightenViewDelegate?
-
The image that is to be displayed.
Declaration
Swift
open var image: UIImage? { get set }
-
The straighten angle to apply to the image in radians.
Declaration
Swift
open var straightenAngle: CGFloat { get set }
-
The crop rect to fit the image into. This rect should be relative to the view.
Declaration
Swift
open var cropRect: CGRect { get set }
-
The orientation to apply to the image.
Declaration
Swift
open var orientation: Orientation { get set }
-
The crop rect in image dimensions.
Declaration
Swift
open var imageCropRect: CGRect { get }
-
Converts a view rect to image dimensions.
Declaration
Swift
open func imageCropRect(forViewRect viewRect: CGRect) -> CGRect
Parameters
viewRect
The view rect to convert.
Return Value
The crop rect in image dimensions.
-
Updates the scroll view’s zoom scale and content offset, such that the image region fits into the crop rect.
Declaration
Swift
open func fitImageRegion(_ imageRegion: CGRect, inCropRectAnimated animated: Bool)
Parameters
imageRegion
The image region to fit into the crop rect.
animated
Whether or not to animate the change.
-
Returns whether the user has touched the content to initiate scrolling.
Note
The value of this property istrue
if the user has touched the image but might not have yet have started dragging it.Declaration
Swift
open private(set) var isTracking: Bool { get set }
-
Returns whether the content is moving in the view after the user lifted their finger.
Note
The returned value istrue
if user isn’t dragging the content but scrolling is still occurring.Declaration
Swift
open var isDecelerating: Bool { get }
-
The frame of the crop canvas. This can be smaller than the bounds of the view so that a padding can be added to the view. If this is set to an empty rect,
bounds
will be returned.Declaration
Swift
open var canvasFrame: CGRect { get set }