DSRect
The DSRect class represents a rectangle in 2D space, which contains four integer values that specify the top, left, right, and bottom edges of the rectangle.
Definition
Assembly: DynamsoftCaptureVisionBundle.xcframework
- Objective-C
- Swift
@interface DSRect : NSObjectclass Rect : NSObject
Attributes & Methods
| Attributes | Type | Description |
|---|---|---|
top |
CGFloat | The distance between the top of the rect and the x-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the height of the parent. If measuredInPercentage = 0, the value specifies a pixel length. |
left |
CGFloat | The distance between the left of the rect and the y-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the width of the parent. If measuredInPercentage = 0, the value specifies a pixel length. |
right |
CGFloat | The distance between the right of the rect and the y-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the width of the parent. If measuredInPercentage = 0, the value specifies a pixel length. |
bottom |
CGFloat | The distance between the bottom of the rect and the x-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the height of the parent. If measuredInPercentage = 0, the value specifies a pixel length. |
measuredInPercentage |
BOOL | Indicates if the rectangle’s measurements are in percentages. |
| Method | Description |
|---|---|
initWith(left:top:right:bottom:measuredInPercentage:) |
The constructor. Creates a DSRect from the specified parameters. |
top
The distance between the top of the rect and the x-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the height of the parent. If measuredInPercentage = 0, the value specifies a pixel length.
- Objective-C
- Swift
@property (nonatomic, assign) CGFloat topvar top: CGFloat { get set }
left
The distance between the left of the rect and the y-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the width of the parent. If measuredInPercentage = 0, the value specifies a pixel length.
- Objective-C
- Swift
@property (nonatomic, assign) CGFloat leftvar left: CGFloat { get set }
right
The distance between the right of the rect and the y-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the width of the parent. If measuredInPercentage = 0, the value specifies a pixel length.
- Objective-C
- Swift
@property (nonatomic, assign) CGFloat rightvar right: CGFloat { get set }
bottom
The distance between the bottom of the rect and the x-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the height of the parent. If measuredInPercentage = 0, the value specifies a pixel length.
- Objective-C
- Swift
@property (nonatomic, assign) CGFloat bottomvar bottom: CGFloat { get set }
measuredInPercentage
Sets whether to use percentages to measure the region size.
- Objective-C
- Swift
@property (nonatomic, assign) BOOL measuredInPercentagevar measuredInPercentage: Bool { get set }
initWith(left
right:bottom:measuredInPercentage:)
The constructor. Creates a DSRect from the specified parameters.
- Objective-C
- Swift
- (instancetype)initWithLeft:(CGFloat)left top:(CGFloat)top right:(CGFloat)right bottom:(CGFloat)bottom measuredInPercentage:(BOOL)measuredInPercentage;init(left: CGFloat, top: CGFloat, right: CGFloat, bottom: CGFloat, measuredInPercentage: Bool)