TextDrawingItem
TextDrawingItem
is a subclass of DrawingItem
. Dynamsoft Camera Enhancer will draw the TextDrawingItem
on the UI if it is created and added to the DCECameraView
or DCEImageEditorView
.
- Objective-C
- Swift
@interface TextDrawingItem (DrawingItem)
class TextDrawingItem : DrawingItem
Method Name | Description |
---|---|
initWithText |
The constructor of TextDrawingItem . Initialize the instance of TextDrawingItem . |
text |
The property that indicates the text of the TextDrawingItem . |
rect |
The CGRect property that indicates the location of the TextDrawingItem . |
drawingStyleId |
Get the drawing style of the current DrawingItem . |
state |
Set the state of the current DrawingItem . |
getMediaType |
Get the media type of the current DrawingItem . |
initWithText
The constructor of TextDrawingItem
. Initialize the instance of TextDrawingItem
.
- Objective-C
- Swift
- (instancetype) initWithText:(NSString*)text textRect(CGRect)textRect;
init(text: String, rect: CGRect)
Parameters
text
: The text of the TextDrawingItem
.
textRect
: The CGRect
that indicates the location of the TextDrawingItem
.
Code Snippet
- Objective-C
- Swift
DrawingItem* drawingItem = [[TextDrawingItem alloc] initWithText:@"" rect:rect];
let drawingItem = TextDrawingItem.init(text:"Your-Text", rect:rect)
text
The property that indicates the text of the TextDrawingItem
.
- Objective-C
- Swift
@property (assign, nonatomic, readonly) NSString* text;
var text: String { get }
rect
The CGRect
property that indicates the location of the TextDrawingItem
.
- Objective-C
- Swift
@property (nonatomic, readonly) CGRect rect;
var rect: CGRect { get }
drawingStyleId
The property that identifies the ID of the DrawingStyle
.
- Objective-C
- Swift
@property (assign, nonatomic) NSInteger drawingStyleId;
var drawingStyleId: Int { get set }
state
The property that indicates the state of the DrawingItem
. View all available DrawingItem
states in EnumDrawingItemState
.
- Objective-C
- Swift
@property (assign, nonatomic) EnumDrawingItemState state;
var state: EnumDrawingItemState { get set }
getMediaType
Get the media type of the DrawingItem
.
- Objective-C
- Swift
- (EnumDrawingItemMediaType) getMediaType;
func getMediaType() -> EnumDrawingItemMediaType
Return Value
The media type of the DrawingItem
.
Code Snippet
- Objective-C
- Swift
EnumDrawingItemMediaType mediaType = [drawingItem getMediaType];
let mediaType = drawingItem.getMediaType()