MBCPosition
Objective-C
@interface MBCPosition : NSObject
Swift
class MBCPosition : NSObject
Class representing a position on the image. It’s given as a box, with sides aligned to the sides of the image.
-
Upper left corner
Declaration
Objective-C
@property (nonatomic) CGPoint ul;Swift
var ul: CGPoint { get set } -
Upper right corner
Declaration
Objective-C
@property (nonatomic) CGPoint ur;Swift
var ur: CGPoint { get set } -
Lower left corner
Declaration
Objective-C
@property (nonatomic) CGPoint ll;Swift
var ll: CGPoint { get set } -
Lower right corner
Declaration
Objective-C
@property (nonatomic) CGPoint lr;Swift
var lr: CGPoint { get set } -
Initializer
Declaration
Objective-C
- (nonnull instancetype)initWithUpperLeft:(CGPoint)ul upperRight:(CGPoint)ur lowerLeft:(CGPoint)ll lowerRight:(CGPoint)lr;Swift
init(upperLeft ul: CGPoint, upperRight ur: CGPoint, lowerLeft ll: CGPoint, lowerRight lr: CGPoint)Parameters
ulupper left corner
urupper right corner
lllower left cornder
lrlower right corner
Return Value
initialized position
-
Creates a position with offset to a current position. Offset is added.
Declaration
Objective-C
- (nonnull MBCPosition *)positionWithOffset:(CGPoint)offset;Swift
func withOffset(_ offset: CGPoint) -> MBCPositionParameters
offsetOffset by which new position is displaced from the current one. It’s specified with CGPoint, where x value defines x offset, and y value defines y offset
Return Value
position with offset
-
Helper method converting Position to CGRect
Declaration
Objective-C
- (CGRect)rect;Swift
func rect() -> CGRectReturn Value
Position converted to CGRect
-
Helper method calculating the center of the Position
Declaration
Objective-C
- (CGPoint)center;Swift
func center() -> CGPointReturn Value
center of the position.
-
Helper method calculating the height of the position
Declaration
Objective-C
- (CGFloat)height;Swift
func height() -> CGFloatReturn Value
height of the position
View on GitHub