DSDrawingItem
The DSDrawingItem
class represents a base class for drawing items, which can be added to drawing layers to draw basic graphics on the view.
Definition
Assembly: DynamsoftCore.xcframework
- Objective-C
- Swift
@interface DSDrawingItem : NSObject
class DrawingItem : NSObject
Attributes
Attributes | Type | Description |
---|---|---|
drawingStyleId |
NSInteger | The DrawingStyle of the DrawingItem. If a DrawingItem holds a drawingStyleId, it will not use the default style of its layer. |
state |
DSDrawingItemState | The state of the DrawingItem. |
CoordinateBase |
DSCoordinateBase | The coordinate base of the DrawingItem. The coordinate base is image by default. |
Methods
Method | Description |
---|---|
getMediaType |
Get the media type of the DrawingItem. |
addNote |
Add a note to the DrawingItem. |
getNote |
Get the specified DSNote. |
hasNote |
Check whether the specified Note exists. |
updateNote |
Update the content of the specified DSNote. |
deleteNote |
Remove the specified DSNote with the specified name. |
getAllNotes |
Get all DSNotes of this DrawingItem. |
clearNotes |
Remove all DSNotes of this DrawingItem. |
drawingStyleId
The DrawingStyle of the DrawingItem. If a DrawingItem holds a drawingStyleId, it will not use the default style of its layer.
- Objective-C
- Swift
@property (assign, nonatomic) NSInteger drawingStyleId
var drawingStyleId: Int { get set }
state
The state of the DrawingItem.
- Objective-C
- Swift
@property (assign, nonatomic) DSDrawingItemState state
var state: DSDrawingItemState { get set }
CoordinateBase
The coordinate base of the DrawingItem. The coordinate base is image by default.
- Objective-C
- Swift
@property (assign, nonatomic, readonly) DSCoordinateBase CoordinateBase
var CoordinateBase: DSCoordinateBase { get }
getMediaType
Get the media type of the DrawingItem.
- Objective-C
- Swift
- (DSDrawingItemMediaType)getMediaType;
func getMediaType() -> DSDrawingItemMediaType
addNote
Add a note to the DrawingItem.
- Objective-C
- Swift
- (void)addNote:(DSNote *)note replace:(bool)replace;
func addNote(_ note: DSNote, replace: Bool)
Parameters
note
: The DSNote object to add.
replace
: Whether to replace the previous one when there already exists a DSNote with the same name.
getNote
Get the specified DSNote.
- Objective-C
- Swift
- (DSNote *)getNote:(NSString *)noteName;
func getNote(_ noteName: String) -> DSNote?
Parameters
noteName
: The name of the DSNote.
Return Value
The specified DSNote object.
hasNote
Check whether the specified Note exists.
- Objective-C
- Swift
- (bool)hasNote:(NSString *)noteName;
func hasNote(_ noteName: String) -> Bool
Parameters
noteName
: The name of the DSNote.
Return Value
Whether the specified Note exists.
updateNote
Update the content of the specified DSNote.
- Objective-C
- Swift
- (void)updateNote:(NSString *)name content:(NSString *)content mergeContent:(bool)mergeContent;
func updateNote(_ name: String, content: String, mergeContent: Bool)
Parameters
name
: The name of the DSNote.
content
: The content to add or replace with.
mergeContent
: If true, merge the new content to the previous content. Otherwise, replace it.
deleteNote
Remove the specified DSNote with the specified name.
- Objective-C
- Swift
- (void)deleteNote:(NSString *)name;
func deleteNote(_ name: String)
Parameters
name
: The name of the DSNote.
getAllNotes
Get all DSNotes of this DrawingItem.
- Objective-C
- Swift
- (NSArray<DSNote *> *)getAllNotes;
func getAllNotes() -> [Note]
Return Value
An array of DSNote.
clearNotes
Remove all DSNotes of this DrawingItem.
- Objective-C
- Swift
- (void)clearNotes;
func clearNotes()