Deprecation warning
Please note that this is outdated documentation for an older release of the Scandit Barcode Scanner SDK.
We are deprecating the 5.x API on all platforms (except Linux). Release 5.19 in April 2021 will be our final. Applications running 5.x will continue to work, and we will continue to release critical bug fixes and security patches only, for one year. We encourage you to migrate to 6.x and take advantage of our latest / advanced features and improved performance.
You'll find the updated documentation at: Data Capture SDK Documentation for Xamarin.Android and Data Capture SDK Documentation for Xamarin.iOS
Public Member Functions | |
IntPtr | Constructor (ScanSettings settings) |
Barcode Decoder Configuration | |
void | ApplyScanSettings (ScanSettings settings, [NullAllowed] CompletionHandler completionHandler) |
Barcode Recognition Operation | |
bool | IsScanning () |
void | StartScanning (bool paused, [NullAllowed] CompletionHandler completionHandler) |
void | StartScanning () |
void | StartScanning (bool paused) |
void | StopScanning ([NullAllowed] CompletionHandler completionHandler) |
void | StopScanning () |
void | ResumeScanning () |
void | ResumeScanning ([NullAllowed] CompletionHandler completionHandler) |
void | PauseScanning () |
void | PauseScanning ([NullAllowed] CompletionHandler completionHandler) |
Utility | |
Point | ConvertPoint (Point point) |
Camera Selection | |
bool | SupportsCameraFacing (CameraFacingDirection facing) |
bool | ChangeToCameraFacing (CameraFacingDirection facing) |
bool | SwitchCameraFacing () |
Torch Control | |
void | SwitchTorchOn (bool on) |
Zoom control | |
bool | SetRelativeZoom (float zoom) |
Properties | |
UIInterfaceOrientationMask | allowedInterfaceOrientations [get, set] |
NSObject | WeakProcessFrameDelegate [get, set] |
NSObject | WeakScanDelegate [get, set] |
ScanOverlay | OverlayView [get, set] |
CameraFacingDirection | CameraFacingDirection [get] |
AVCaptureVideoOrientation | CameraPreviewOrientation [get, set] |
bool | AutoFocusOnTapEnabled [get, set] |
bool | PinchToZoomEnabled [get, set] |
Detailed Description
Controls the camera and orchestrates the barcode scanning process.
The barcode picker provides a high-level interface for scanning barcodes on iOS. The class is responsible for initializing and controlling the camera and manages the low-level barcode scanning process. The barcode picker also provides a configurable scan user interface in which recognized codes are highlighted.
Example (minimal) usage:
Set up the barcode picker in one of your view controllers:
- Since
- 4.7.0
Member Function Documentation
IntPtr Constructor | ( | ScanSettings | settings | ) |
Initializes the barcode picker with the desired scan settings.
Note that the initial invocation of this method will activate the Scandit Barcode Scanner SDK, after which the device will count towards your device limit.
Make sure to set the app key available from your Scandit account through ScanditBarcodeScanner.iOS.License.SetAppKey before you call this initializer.
- Since
- 4.7.0
- Parameters
-
settings The scan settings to use. You may pass nil, which is identical to passing a settings instance constructed through ScanditBarcodeScanner.iOS.ScanSettings.DefaultSettings.
- Returns
- The newly constructed barcode picker instance.
void ApplyScanSettings | ( | ScanSettings | settings, |
[NullAllowed] CompletionHandler | completionHandler | ||
) |
Change the scan settings of an existing picker instance.
The scan settings are applied asynchronously after this call returns. You may use the completion handler to get notified when the settings have been applied to the picker. All frames processed after the settings have been applied will use the new scan settings.
- Parameters
-
settings The new scan settings to apply. completionHandler An optional block that will be invoked when the settings have been applied to the picker. The block will be invoked on an internal picker dispatch queue.
- Since
- 4.7.0
bool IsScanning | ( | ) |
Returns YES if scanning is in progress.
- Since
- 1.0.0
- Returns
- boolean indicating whether scanning is in progress.
void StartScanning | ( | bool | paused, |
[NullAllowed] CompletionHandler | completionHandler | ||
) |
Starts/restarts the camera and potentially the scanning process.
Start or continue scanning barcodes after the creation of the barcode picker or a previous call to PauseScanning, ScanSession.PauseScanning, StopScanning or ScanSession.stopScanning.
In contrast to resumeScanning, startScanning clears the current barcode scanner session.
- Since
- 4.7.0
- Parameters
-
paused If YES the barcode/2D recognition is paused but the streaming of preview images is started. If NO both the barcode/2D recognition and the streaming of preview images are started. completionHandler If nonnull, the handler is invoked when the camera has completed intiitalization. The handler is invoked from a picker-internal queue, which may or may not run on the UI thread.
void StartScanning | ( | ) |
Starts/restarts the camera and the scanning process.
Start or continue scanning barcodes after the creation of the barcode picker or a previous call to PauseScanning, ScanSession.PauseScanning, StopScanning or ScanSession.StopScanning.
This method is a convenience shortcut for calling picker.StartScanning(false, null)
;
- Since
- 4.7.0
void StartScanning | ( | bool | paused | ) |
Starts/restarts the camera and potentially the scanning process.
Start or continue scanning barcodes after the creation of the barcode picker or a previous call to PauseScanning, ScanSession.PauseScanning, StopScanning or ScanSession.StopScanning.
In contrast to resumeScanning, startScanning clears the current barcode scanner session.
- Since
- 4.7.0
- Parameters
-
paused If YES the barcode/2D recognition is paused but the streaming of preview images is started. If NO both the barcode/2D recognition and the streaming of preview images are started.
void StopScanning | ( | [NullAllowed] CompletionHandler | completionHandler | ) |
Stop scanning and the video preview.
- Since
- 4.7.0
- Parameters
-
completionHandler An optional block that will be invoked when the picker has been stopped. The block will be invoked on an internal picker dispatch queue.
void StopScanning | ( | ) |
Stop scanning and the video preview.
- Since
- 4.7.0
void ResumeScanning | ( | ) |
Resume scanning codes.
Continue (resume) scanning barcodes after a previous call to pauseScanning, or ScanSession.PauseScanning. Calling ResumeScanning on a picker that was stopped with StopScanning, will not resume the scanning process.
In contrast to startScanning, resumeScanning does not clear the current barcode scanner session. Thus if you want accumulate the codes, use PauseScanning/ResumeScanning, if you want to start from an empty session, use PauseScanning/StartScanning.
- Since
- 4.7.0
void ResumeScanning | ( | [NullAllowed] CompletionHandler | completionHandler | ) |
Resume scanning codes.
Continue (resume) scanning barcodes after a previous call to pauseScanning, or ScanSession.PauseScanning. Calling ResumeScanning on a picker that was stopped with stopScanning, will not resume the scanning process.
In contrast to StartScanning, ResumeScanning does not clear the current barcode scanner session. Thus if you want accumulate the codes, use PauseScanning/ResumeScanning, if you want to start from an empty session, use PauseScanning/StartScanning.
- Parameters
-
completionHandler callback to be invoked when the scanning has been resumed.
- Since
- 4.16.0
void PauseScanning | ( | ) |
Pause scanning but keep preview on.
This method pauses barcode/2D recognition but continues streaming preview images. Use this method if you are interrupting barcode recognition for a short time and want to continue scanning barcodes/2D codes afterwards.
Use ResumeScanning to continue scanning barcodes.
- Since
- 4.7.0
void PauseScanning | ( | [NullAllowed] CompletionHandler | completionHandler | ) |
Pause scanning but keep preview on.
This method pauses barcode/2D recognition but continues streaming preview images. Use this method if you are interrupting barcode recognition for a short time and want to continue scanning barcodes/2D codes afterwards.
Use ResumeScanning to continue scanning barcodes.
- Parameters
-
completionHandler callback to be invoked when the scanning has been paused.
- Since
- 4.7.0
Point ConvertPoint | ( | Point | point | ) |
Converts a point of a Barcode's location into this picker's coordinate system.
The conversion takes the current resolution of the camera feed into consideration which means that if the resolution should change converting a previously retrieved point successfully is no longer possible. A change in resolution happens for example if ScanSettings::HighDensityModeEnabled is changed or the camera is switched from back to front or vice versa.
- Since
- 4.9.0
- Parameters
-
point The point to be converted.
- Returns
- The point in the picker's coordinate system.
- See also
- Barcode.Location
bool SupportsCameraFacing | ( | CameraFacingDirection | facing | ) |
Returns whether the specified camera facing direction is supported by the current device.
- Since
- 3.0.0
- Parameters
-
facing The camera facing direction in question.
- Returns
- Whether the camera facing direction is supported
bool ChangeToCameraFacing | ( | CameraFacingDirection | facing | ) |
Changes to the specified camera facing direction if it is supported.
- Since
- 3.0.0
- Parameters
-
facing The new camera facing direction
- Returns
- Whether the change was successful
bool SwitchCameraFacing | ( | ) |
Changes to the opposite camera facing if it is supported.
- Since
- 3.0.0
- Returns
- Whether the change was successful
void SwitchTorchOn | ( | bool | on | ) |
Switches the torch (if available) on or off programmatically.
There is also a method in the ScanditSDKOverlayController to add a torch icon that the user can click to activate the torch.
- Parameters
-
on YES when the torch should be switched on, NO if the torch should be turned off.
By default the torch switch is off.
- Since
- 2.0.0
bool SetRelativeZoom | ( | float | zoom | ) |
Sets the zoom to the given percentage of the maximum analog zoom possible.
- Parameters
-
zoom The percentage of the max zoom (between 0 and 1)
- Returns
- Whether setting the zoom was successful
- Since
- 4.7.0
Property Documentation
|
getset |
Orientations that the barcode picker is allowed to rotate to.
The orientations returned by this view controller's supportedInterfaceOrientations function. Be aware that this orientation mask will not be taken into consideration if the view controller is part of a UITableViewController for example (in that case the UITableViewController's supportedInterfaceOrientations matter). This orientation will also not be taken into consideration if this view controller's view is directly added to a view hierarchy.
By default all orientations are allowed (UIInterfaceOrientationMaskAll).
- Since
- 4.7.0
|
getset |
The process frame delegate for this barcode picker.
|
getset |
The scan delegate for this barcode picker.
ScanditBarcodeScanner.iOS.ScanDelegate.DidScan is invoked on the registered scanDelegate whenever a new barcode/2d code has been recognized. To react to barcode scanned events, you must provide a scan delegate that contains your application logic.
- Since
- 4.7.0
|
getset |
The overlay controller controls the scan user interface.
The Scandit BarcodeScanner contains a default implementation that developers can inherit from to define their own scan UI (enterprise licensees only).
- Since
- 4.7.0
The facing direction of the used camera.
- Since
- 2.0.0
|
getset |
The orientation of the camera preview.
The orientation of the camera preview. In general the preview's orientation will be as wanted, but there may be cases where it needs to be set individually. This does not change the orientation of the overlayed UI elements.
Possible values are: AVCaptureVideoOrientationPortrait, AVCaptureVideoOrientationPortraitUpsideDown, AVCaptureVideoOrientationLandscapeLeft, AVCaptureVideoOrientationLandscapeRight
|
getset |
Whether tapping on the screen should trigger an auto-focus.
By default, the camera triggers an auto-focus whenever the user taps the screen. To disable this feature, set this property to NO.
|
getset |
Whether pinch to zoom is enabled.
By default, the camera preview zoom factor can be changed by using a pinch gesture. To disable this feature, set this property to NO. The feature is only available on devices with iOS 7 and greater.
- Since
- 4.15