MBPosition


@interface MBPosition : NSObject

Class representing a position on the image. It’s given as a box, with sides aligned to the sides of the image.

  • ul

    Upper left corner

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGPoint ul;

    Swift

    var ul: CGPoint { get set }
  • ur

    Upper right corner

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGPoint ur;

    Swift

    var ur: CGPoint { get set }
  • ll

    Lower left corner

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGPoint ll;

    Swift

    var ll: CGPoint { get set }
  • lr

    Lower right corner

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGPoint lr;

    Swift

    var lr: CGPoint { get set }
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)init NS_UNAVAILABLE;
  • 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

    ul

    upper left corner

    ur

    upper right corner

    ll

    lower left cornder

    lr

    lower right corner

    Return Value

    initialized position

  • Creates a position with offset to a current position. Offset is added.

    Declaration

    Objective-C

    - (nonnull MBPosition *)positionWithOffset:(CGPoint)offset;

    Swift

    func withOffset(_ offset: CGPoint) -> MBPosition

    Parameters

    offset

    Offset 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() -> CGRect

    Return Value

    Position converted to CGRect

  • Helper method calculating the center of the Position

    Declaration

    Objective-C

    - (CGPoint)center;

    Swift

    func center() -> CGPoint

    Return Value

    center of the position.

  • Helper method calculating the height of the position

    Declaration

    Objective-C

    - (CGFloat)height;

    Swift

    func height() -> CGFloat

    Return Value

    height of the position