SBSDKDocumentScannerViewController
@interface SBSDKDocumentScannerViewController : SBSDKBaseScannerViewController
A UIViewController subclass to show a camera screen and run a user guiding document detector. The detection result is visualized using a polygonal bezier path. This class cannot be instanced from a storyboard. Instead it is installing itself as a child view controller onto a given parent view controller. This is a simpler version of ‘SBSDKScannerViewController’ that is more in-line with other classic UI SDK components. As a subclass of ‘SBSDKBaseScannerViewController’ it benefits from all its advantages, e.g. zooming, view finder, and energy management.
-
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:(nonnull UIView *)containerView delegate: (nullable id<SBSDKDocumentScannerViewControllerDelegate>) delegate;
Swift
init?(parentViewController: UIViewController, parentView containerView: UIView, delegate: SBSDKDocumentScannerViewControllerDelegate?)
Parameters
parentViewController
The view controller the newly created instance is embedded into.
parentView
The view the newly created instance is embedded into.
delegate
The delegate of the receiver.
-
The delegate of the receiver.
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<SBSDKDocumentScannerViewControllerDelegate> delegate;
Swift
weak var delegate: SBSDKDocumentScannerViewControllerDelegate? { get set }
-
The mode of the document detector to be used for document outline detection. The default value can be set via
+ (void)setDefaultDetectorMode:(SBSDKDocumentDetectorMode)newDefaultDetectorMode;
. If not set specifically the default value isSBSDKDocumentDetectorModeMachineLearning
.Declaration
Objective-C
@property (nonatomic) SBSDKDocumentDetectorMode detectorMode;
Swift
var detectorMode: SBSDKDocumentDetectorMode { get set }
-
The preferred aspect ratios for the document detector. If nil or empty, the aspect ratio will not be taken into account when selecting the best document polygon. If set, polygons with an aspect ratio in this list will be selected more preferrably. Defaults to nil.
Declaration
Objective-C
@property (nonatomic, strong, nullable) NSArray<SBSDKAspectRatio *> *preferredAspectRatios;
Swift
var preferredAspectRatios: [SBSDKAspectRatio]? { get set }
-
The required aspect ratios for the document detector. If nil or empty, the aspect ratio will not be taken into account when detecting documents. Otherwise the detector will only detect documents with one of the given required aspect ratios. Defaults to nil.
Declaration
Objective-C
@property (nonatomic, strong, nullable) NSArray<SBSDKAspectRatio *> *requiredAspectRatios;
Swift
var requiredAspectRatios: [SBSDKAspectRatio]? { get set }
-
If set to YES, the documents aspect ratio is not compared to the screens aspect ratio, the bad aspect ratio warning will never appear. Defaults to NO.
Declaration
Objective-C
@property (nonatomic) BOOL ignoreBadAspectRatio;
Swift
var ignoreBadAspectRatio: Bool { get set }
-
The minimum score in percent (0 - 100) of the perspective distortion to accept a detected document. Default is 75.0. Set lower values to accept more perspective distortion. Warning: Lower values result in more blurred document images.
Declaration
Objective-C
@property (nonatomic) double acceptedAngleScore;
Swift
var acceptedAngleScore: Double { get set }
-
The minimum size in percent (0 - 100) of the screen size to accept a detected document. It is sufficient that height or width match the score. Default is 80.0. Warning: Lower values result in low resolution document images.
Declaration
Objective-C
@property (nonatomic) double acceptedSizeScore;
Swift
var acceptedSizeScore: Double { get set }
-
The auto-snapping mode. Default is SBSDKAutosnappingModeEnabled.
Declaration
Objective-C
@property (nonatomic) SBSDKAutosnappingMode autoSnappingMode;
Swift
var autoSnappingMode: SBSDKAutosnappingMode { get set }
-
The sensitivity of auto-snapping. Values are clamped to the range 0.0 - 1.0. A value of 1.0 triggers automatic snapping immediately, a value of 0.0 delays the automatic by 3 seconds.
Declaration
Objective-C
@property (nonatomic) CGFloat autoSnappingSensitivity;
Swift
var autoSnappingSensitivity: CGFloat { get set }
-
The minimum delay in seconds between two consecutive automatic image captures. Defaults to 0.0 secs.
Set to higher values if after capturing a document image the same document is captured again too quickly.Declaration
Objective-C
@property (nonatomic) NSTimeInterval autoSnappingDelay;
Swift
var autoSnappingDelay: TimeInterval { get set }
-
The default snap button.
Declaration
Objective-C
@property (nonatomic, readonly) SBSDKShutterButton *_Nonnull snapButton;
Swift
var snapButton: SBSDKShutterButton { get }
-
Sets a custom snapping button. If not nil, it replaces the default snapping button. The setter configures the customs buttons action-target automatically and hides the default snapping button. You are responsible for placing the button in the view hierarchy and layout. If the custom button is of class SBSDKShutterButton, the buttons status will be automatically updated. Setting it to nil, will restore the default snapping button, you are responsible for removing it from the view hierarchy.
Declaration
Objective-C
@property (nonatomic, strong, nullable) UIButton *customSnapButton;
Swift
var customSnapButton: UIButton? { get set }
-
Whether the snap button is hidden or not. Defaults to NO.
Declaration
Objective-C
@property (nonatomic) BOOL hideSnapButton;
Swift
var hideSnapButton: Bool { get set }
-
The configuration object for the document detection status text.
Declaration
Objective-C
@property (nonatomic, strong) SBSDKDocumentScannerStatusTextConfiguration *_Nonnull statusTextConfiguration;
Swift
var statusTextConfiguration: SBSDKDocumentScannerStatusTextConfiguration { get set }
-
If set to NO the detection status label is always shown, if its text is non-empty. Otherwise it is hidden.
Declaration
Objective-C
@property (nonatomic) BOOL suppressDetectionStatusLabel;
Swift
var suppressDetectionStatusLabel: Bool { get set }
-
If set to NO the polygon layer is always shown, if there was a document polygon detected. Otherwise it is hidden.
Declaration
Objective-C
@property (nonatomic) BOOL suppressPolygonLayer;
Swift
var suppressPolygonLayer: Bool { get set }
-
Whether the polygon-displaying layer is hidden or not. Defaults to NO.
Declaration
Objective-C
@property (nonatomic) BOOL hidePolygonLayer;
Swift
var hidePolygonLayer: Bool { get set }
-
The scaling factor for captured images. Values are clamped to the range 0.0 - 1.0.
Declaration
Objective-C
@property (nonatomic) CGFloat imageScale;
Swift
var imageScale: CGFloat { get set }
-
Limits the maximum size of the document image. If width or height are zero, this property is effectively ignored. Defaults to CGSizeZero.
Declaration
Objective-C
@property (nonatomic) CGSize documentImageSizeLimit;
Swift
var documentImageSizeLimit: CGSize { get set }
-
The filter to be applied to the snapped document image. Defaults to SBSDKImageFilterTypeNone.
Declaration
Objective-C
@property (nonatomic) SBSDKImageFilterType documentImageFilter;
Swift
var documentImageFilter: SBSDKImageFilterType { get set }
-
The line width for the polygon displayed around the detected document.
Declaration
Objective-C
@property (nonatomic) CGFloat polygonLineWidth;
Swift
var polygonLineWidth: CGFloat { get set }
-
The line color for the polygon displayed over the detected document when the document detection status is SBSDKDocumentDetectionStatusOK.
Declaration
Objective-C
@property (nonatomic, strong) UIColor *_Nonnull polygonLineColorAccepted;
Swift
var polygonLineColorAccepted: UIColor { get set }
-
The line color for the polygon displayed over the detected document when the document detection status is not SBSDKDocumentDetectionStatusOK.
Declaration
Objective-C
@property (nonatomic, strong) UIColor *_Nonnull polygonLineColorRejected;
Swift
var polygonLineColorRejected: UIColor { get set }
-
The fill color for the polygon displayed over the detected document when the document detection status is SBSDKDocumentDetectionStatusOK.
Declaration
Objective-C
@property (nonatomic, strong) UIColor *_Nonnull polygonFillColorAccepted;
Swift
var polygonFillColorAccepted: UIColor { get set }
-
The fill color for the polygon displayed over the detected document when the document detection status is not SBSDKDocumentDetectionStatusOK.
Declaration
Objective-C
@property (nonatomic, strong) UIColor *_Nonnull polygonFillColorRejected;
Swift
var polygonFillColorRejected: UIColor { get set }
-
Whether the polygon auto snap progress animation is enabled or not. Defaults to YES.
Declaration
Objective-C
@property (nonatomic) BOOL polygonAutoSnapProgressEnabled;
Swift
var polygonAutoSnapProgressEnabled: Bool { get set }
-
Stroke color of polygon auto snap progress animation. Defaults to blue.
Declaration
Objective-C
@property (nonatomic, strong) UIColor *_Nonnull polygonAutoSnapProgressColor;
Swift
var polygonAutoSnapProgressColor: UIColor { get set }
-
Line width of polygon auto snap progress animation. Defaults to 5.0.
Declaration
Objective-C
@property (nonatomic) CGFloat polygonAutoSnapProgressLineWidth;
Swift
var polygonAutoSnapProgressLineWidth: CGFloat { get set }
-
The radius to use when drawing rounded corners of the polygon. Defaults to 8.0.
Declaration
Objective-C
@property (nonatomic) CGFloat polygonCornerRadius;
Swift
var polygonCornerRadius: CGFloat { get set }
-
The font size of the user guidance label. Defaults to 17.
Declaration
Objective-C
@property (nonatomic) CGFloat detectionStatusFontSize;
Swift
var detectionStatusFontSize: CGFloat { get set }
-
Captures the currently detected document image, as if the user would press the shutter button or the auto-snapping fires. Calls the appropriate delegate functions.
Declaration
Objective-C
- (void)captureDocumentImage;
Swift
func captureDocumentImage()