SBSDKBarcodeScannerViewController

@interface SBSDKBarcodeScannerViewController : SBSDKBaseCameraViewController

UIViewController subclass showing a camera screen and barcode detector. This class cannot be instanced from a storyboard. Instead it is installing itself as a child view controller onto a given parent view controller.

  • The delegate. See SBSDKBarcodeScannerViewControllerDelegate protocol. Weak.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<SBSDKBarcodeScannerViewControllerDelegate> delegate;

    Swift

    weak var delegate: SBSDKBarcodeScannerViewControllerDelegate? { get set }
  • Specifies the way of barcode images generation or disables this generation at all. Use, if you want to receive a full sized image with barcodes. Defaults to SBSDKBarcodeImageGenerationTypeNone.

    Declaration

    Objective-C

    @property (nonatomic) SBSDKBarcodeImageGenerationType barcodeImageGenerationType;

    Swift

    var barcodeImageGenerationType: SBSDKBarcodeImageGenerationType { get set }
  • Machine code types (EAN, DataMatrix, Aztec, QR, etc) that can be returned in didDetectBarcodes delegate method. When nil or empty - all codes can be returned. Default is nil.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSArray<SBSDKBarcodeType *> *acceptedBarcodeTypes;

    Swift

    var acceptedBarcodeTypes: [SBSDKBarcodeType]? { get set }
  • Additional parameters for tweaking the detection of barcodes.

    Declaration

    Objective-C

    @property (nonatomic, strong, nonnull) SBSDKBarcodeAdditionalParameters *additionalDetectionParameters;

    Swift

    var additionalDetectionParameters: SBSDKBarcodeAdditionalParameters { get set }
  • Bar code document types to limit detection results to. When nil or empty - all document can be returned. Default is nil.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSArray<SBSDKBarcodeDocumentType *> *acceptedDocumentTypes;

    Swift

    var acceptedDocumentTypes: [SBSDKBarcodeDocumentType]? { get set }
  • Specifies the amount of frames barcode scanner takes before detecting. Uses the sharpest frame. So setting more frames generally improves recognition quality, but reduces recognition speed. Keep in mind, that detectionRate also has influence on recognition speed, as it determines the amount of frames that can be read per second. Default to 5.

    Declaration

    Objective-C

    @property (nonatomic) NSInteger barcodeAccumulatedFramesCount;

    Swift

    var barcodeAccumulatedFramesCount: Int { get set }
  • A transparent view that lies over the preview layer. You can add custom UI here. Read-only.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nonnull) UIView *HUDView;

    Swift

    var hudView: UIView { get }
  • The range of valid camera zoom factors. Default value is (1.0; 3.0).

    Declaration

    Objective-C

    @property (nonatomic, strong) SBSDKZoomRange *_Nonnull cameraZoomRange;

    Swift

    var cameraZoomRange: SBSDKZoomRange { get set }
  • The zoom level of the camera relative to zoomRange. The minimum value is 0.0 and corresponds to the cameraZoomRange.minZoom value (zoomed out). The maximum value is 1.0 and corresponds to the cameraZoomRange.maxZoom value (zoomed in). The default value is 0.0.

    You can use this value to zoom the camera programmatically but also to set an initial zoom factor.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat cameraZoomFactor;

    Swift

    var cameraZoomFactor: CGFloat { get set }
  • When this property is set to YES, the default, the zoom can be activated by double tapping somewhere on the receivers view.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isDoubleTapToZoomEnabled) BOOL doubleTapToZoomEnabled;

    Swift

    var isDoubleTapToZoomEnabled: Bool { get set }
  • When this property is set to YES, the default, the zoom can be activated by executing a pinch gesture somewhere on the receivers view.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isPinchToZoomEnabled) BOOL pinchToZoomEnabled;

    Swift

    var isPinchToZoomEnabled: Bool { get set }
  • Defines, if a zooming in\out should be animated. Default is YES;

    Declaration

    Objective-C

    @property (nonatomic) BOOL shouldAnimateZooming;

    Swift

    var shouldAnimateZooming: Bool { get set }
  • Defines if barcodeScanner should use limiting frame for detection. Alternatively all camera frame will be used. Default is NO.

    Declaration

    Objective-C

    @property (nonatomic) BOOL shouldUseFinderFrame;

    Swift

    var shouldUseFinderFrame: Bool { get set }
  • Defines the region of interest when scanning barcodes or other machine readable codes. Machine readable codes found outside this region of interest are discarded and ignored during detection. The property describes the aspect ratio (width / height) of the region of interest. This aspect ratio, in conjunction with the screen size and finderMinimumInset parameter, is used to create an absolute region of interest and render a view finder like rounded rectangle on screen. The 0 aspect ratio effectively disables the region of interest.

    Note: Only effective if shouldUseFinderFrame is set to YES.

    Declaration

    Objective-C

    @property (nonatomic, strong) SBSDKAspectRatio *_Nonnull finderAspectRatio;

    Swift

    var finderAspectRatio: SBSDKAspectRatio { get set }
  • Defines a minimum inset for capturing frame. Default is 32 for all parameters.

    Note: Only effective if shouldUseFinderFrame is set to YES.

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets finderMinimumInset;

    Swift

    var finderMinimumInset: UIEdgeInsets { get set }
  • Background color of camera preview. Default is black. Can be nil.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *previewBackgroundColor;

    Swift

    var previewBackgroundColor: UIColor? { get set }
  • Background color of the view finder. Default is white with 0.66 alpha. Must not be nil.

    Declaration

    Objective-C

    @property (nonatomic, strong, nonnull) UIColor *viewFinderBackgroundColor;

    Swift

    var viewFinderBackgroundColor: UIColor { get set }
  • Line color of the view finder. Default is nil, which draws no border line for the view finder.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *viewFinderLineColor;

    Swift

    var viewFinderLineColor: UIColor? { get set }
  • Line width of the view finder. Default is 2.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat viewFinderLineWidth;

    Swift

    var viewFinderLineWidth: CGFloat { get set }
  • The current rectangle of the view finder if displayed, CGRectZero otherwise.

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGRect currentViewFinderRect;

    Swift

    var currentViewFinderRect: CGRect { get }
  • Set to YES to toggle on the video light. Defaults to NO.

    Declaration

    Objective-C

    @property (nonatomic) BOOL flashLightEnabled;

    Swift

    var flashLightEnabled: Bool { get set }
  • An IB action to toggle the zoom. Connect to a UIButton instance if needed.

    Declaration

    Objective-C

    - (void)toggleZoom:(nullable id)sender;

    Swift

    @IBAction func toggleZoom(_ sender: Any?)

    Parameters

    sender

    The object that sent the event. Can be nil.

  • An IB action to engage the zoom. Connect to a UIButton instance if needed.

    Declaration

    Objective-C

    - (void)zoomIn:(nullable id)sender;

    Swift

    @IBAction func zoomIn(_ sender: Any?)

    Parameters

    sender

    The object that sent the event. Can be nil.

  • An IB action to disengage the zoom. Connect to a UIButton instance if needed.

    Declaration

    Objective-C

    - (void)zoomOut:(nullable id)sender;

    Swift

    @IBAction func zoomOut(_ sender: Any?)

    Parameters

    sender

    The object that sent the event. Can be nil.

  • Not available.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Not available.

    Declaration

    Objective-C

    + (nonnull instancetype)new;
  • Designated initializer. Installs the receiver as child view controller onto the parent view controllers view using its entire bounds area.

    Declaration

    Objective-C

    - (nullable instancetype)initWithParentViewController:
                                 (nonnull UIViewController *)parentViewController
                                               parentView:
                                                   (nullable UIView *)containerView;

    Swift

    init?(parentViewController: UIViewController, parentView containerView: UIView?)

    Parameters

    parentViewController

    The view controller the newly created instance is embedded into. If parentViewController conforms to SBSDKBarcodeScannerViewControllerDelegate, it is automatically set as delegate.