MBDocumentSubview

Objective-C


@interface MBDocumentSubview : MBSubview

Swift

class MBDocumentSubview : MBSubview

Overlay subview presenting the viewfinder for scanning ID documents

The subview draws a rounded rectangle in the shape of an ID document, in which the user should position the ID (ideal positioning is not required).

The rounded rectangle is centered on the screen.

The aspect ratio of the document can be set as a parameter

  • Default implementation draws a rectangle with aspect ratio of viewfinderAspectRatio, with corner radius set to 10/360 of the rectangle’s width on the center of the view controller

    Declaration

    Objective-C

    @property (nonatomic) UIView *_Nonnull viewfinderView;

    Swift

    var viewfinderView: UIView { get set }
  • Default aspect ratio of the viewfinder, calculated as width / height.

    By default it’s 85.60 / 53.98, which is the dimensions of the ID1 document.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat viewfinderWidthToHeightRatio;

    Swift

    var viewfinderWidthToHeightRatio: CGFloat { get set }
  • Label displayed below the viewfinder view.

    By default it shows text @“Position ID card in this Frame”;

    Declaration

    Objective-C

    @property (nonatomic) UILabel *_Nonnull tooltipLabel;

    Swift

    var tooltipLabel: UILabel { get set }
  • Initialize the overlay subview with a given frame

    Declaration

    Objective-C

    - (nonnull instancetype)initWithFrame:(CGRect)frame;

    Swift

    init(frame: CGRect)

    Parameters

    frame

    frame for the view

    Return Value

    initialized view

  • Initialize the overlay subview with a given coder

    Declaration

    Objective-C

    - (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder;

    Swift

    init?(coder aDecoder: NSCoder)

    Parameters

    aDecoder

    decoder

    Return Value

    initialized view