Resource Base
Table of contents

DSImageEditorView

The DSImageEditorView class represents an image editor view, which allows users to add interactable UI elements on the view.

Definition

Assembly: DynamsoftCore.xcframework

  • Objective-C
  • Swift
  1. @interface DSImageEditorView : UIView
    
  2. class ImageEditorView : UIView
    

Attributes

Attributes Type Description
image The property stores the original image that displayed on the view in a UIImage.  
imageData The property stores the original image that displayed on the view in a ImageData.  
tipConfig DSTipConfig Set/get the tip configurations.
tipVisible BOOL Set/get the visibility of tip.

Methods

Method Description
initWithFrame Create an instance of DSCameraView.
getSelectedDrawingItem Get the selected DrawingItem.
getDrawingLayer Get the specified DrawingLayer.
createDrawingLayer Create a new DrawingLayer.
deleteUserDefinedDrawingLayer Delete the specified drawing layer.
clearUserDefinedDrawingLayers Clear all the user-defined drawing layers.
getAllDrawingLayers Get all the drawing layers on the view.
updateTipMessage Update the tip message.
setDrawingItemClickListener Set a DrawingItemClickListener to receive callback when DrawingItems on the view are clicked.

image

The property stores the original image that displayed on the view in a UIImage.

  • Objective-C
  • Swift
  1. @property (assign, nonatomic) UIImage *image;
    
  2. var image:UIImage { get, set }
    

imageData

The property stores the original image that displayed on the view in a ImageData.

  • Objective-C
  • Swift
  1. @property (assign, nonatomic) DSImageData *imageData;
    
  2. var image:DSImageData { get, set }
    

tipConfig

Set/get the tip configurations.

  • Objective-C
  • Swift
  1. @property (assign, nonatomic) DSTipConfig * tipConfig;
    
  2. var tipConfig: DSTipConfig { get set }
    

tipVisible

Set/get the visibility of tip.

  • Objective-C
  • Swift
  1. @property (assign, nonatomic) BOOL tipVisible;
    
  2. var tipConfig: BOOL { get set }
    

initWithFrame

Create an instance of DSImageEditorView.

  • Objective-C
  • Swift
  1. - (instancetype)initWithFrame:(CGRect)frame;
    
  2. init(frame: CGRect)
    

Parameters

frame: A CGRect value that defines the position of the view.

Return Value

An instance of DSImageEditorView.

Code Snippet

  • Objective-C
  • Swift
  1. DSImageEditorView *editorView = [[DSImageEditorView alloc] initWithFrame:frame];
    
  2. let editorView = DSImageEditorView(frame: frame)
    

getSelectedDrawingItem

Get the selected DrawingItem.

  • Objective-C
  • Swift
  1. - (nullable DSDrawingItem *)getSelectedDrawingItem;
    
  2. func getSelectedDrawingItem() -> DSDrawingItem?
    

Return Value

The selected DrawingItem.

Code Snippet

  • Objective-C
  • Swift
  1. DSDrawingItem *selectedItem = [editorView getSelectedDrawingItem];
    
  2. let selectedItem = editorView.getSelectedDrawingItem()
    

getDrawingLayer

Get the specified DrawingLayer.

  • Objective-C
  • Swift
  1. - (DSDrawingLayer *)getDrawingLayer:(NSInteger)layerId;
    
  2. func getDrawingLayer(_ layerId: Int) -> DSDrawingLayer
    

Parameters

layerId: The ID of the layer that you want to get.

Return Value

The object of the targeting layer.

Code Snippet

  • Objective-C
  • Swift
  1. DSDrawingLayer *drawingLayer = [editorView getDrawingLayer:layerId];
    
  2. let drawingLayer = editorView.getDrawingLayer(layerId)
    

createDrawingLayer

Create a new DrawingLayer.

  • Objective-C
  • Swift
  1. - (DSDrawingLayer *)createDrawingLayer;
    
  2. func createDrawingLayer() -> DSDrawingLayer
    

Return Value

The object of the layer you created.

Code Snippet

  • Objective-C
  • Swift
  1. DSDrawingLayer *drawingLayer = [editorView createDrawingLayer];
    
  2. let drawingLayer = editorView.createDrawingLayer()
    

deleteUserDefinedDrawingLayer

Delete the specified drawing layer.

  • Objective-C
  • Swift
  1. - (void)deleteUserDefinedDrawingLayer:(NSInteger)layerId;
    
  2. func deleteUserDefinedDrawingLayer(_ layerId: Int)
    

Parameters

layerId: The ID of the layer that you want to delete.

Code Snippet

  • Objective-C
  • Swift
  1. [editorView deleteUserDefinedDrawingLayer:layerId];
    
  2. editorView.deleteUserDefinedDrawingLayer(layerId)
    

clearUserDefinedDrawingLayers

Clear all the user-defined drawing layers.

  • Objective-C
  • Swift
  1. - (void)clearUserDefinedDrawingLayers;
    
  2. func clearUserDefinedDrawingLayers()
    

getAllDrawingLayers

Get all the drawing layers on the view.

  • Objective-C
  • Swift
  1. - (NSArray<DSDrawingLayer *>*)getAllDrawingLayers;
    
  2. func getAllDrawingLayers() -> [DrawingLayer]
    

Return Value

All the drawing layers. The return value includes both system drawing layers and user defined drawing layers.

Code Snippet

  • Objective-C
  • Swift
  1. NSArray<DSDrawingLayer *> *drawingLayers = [editorView getAllDrawingLayers];
    
  2. let drawingLayers = editorView.getAllDrawingLayers()
    

updateTipMessage

Update the tip message.

  • Objective-C
  • Swift
  1. - (void)updateTipMessage:(NSString *)tipMessage;
    
  2. func updateTipMessage(_ tipMessage: String)
    

Parameters

tipMessage: The new message that you want to display.

Code Snippet

  • Objective-C
  • Swift
  1. [editorView updateTipMessage:tipMessage];
    
  2. editorView.updateTipMessage(tipMessage)
    

setDrawingItemClickListener

Set a DrawingItemClickListener to receive callback when DrawingItems on the view are clicked.

  • Objective-C
  • Swift
  1. - (void)setDrawingItemClickListener:(id<DSDrawingItemClickListener>)clickListener;
    
  2. func setDrawingItemClickListener(_ clickListener: DrawingItemClickListener)
    

Parameters

clickListener: A protocol instance of DrawingItemClickListener.

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 4.x
    • Version 4.2.10
    • Version 4.2.1
    • Version 4.2.0
    • Version 4.0.2
    • Version 4.0.1
    • Version 4.0.0
  • Version 3.x
    • Version 3.0.3
    • Version 3.0.2
    • Version 3.0.1
    • Version 3.0.0
  • Version 2.x
    • Version 2.3.21
    • Version 2.3.20
    • Version 2.3.12
    • Version 2.3.11
    • Version 2.3.10
    • Version 2.3.5
    • Version 2.3.4
    • Version 2.3.3
    • Version 2.3.2
    • Version 2.3.1
    • Version 2.3.0
    • Version 2.1.4
    • Version 2.1.3
    • Version 2.1.1
    • Version 2.0.0
Change +