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 iOS

Restricting the Area Where Barcodes are Scanned

By default the Scandit Barcode Scanner searches the entire camera feed for barcodes. Under certain conditions it is helpful to restrict the area in which barcodes are recognized, for example if

  • you only show a part of the barcode picker, codes that are not visible should generally not be recognized.
  • there are multiple barcodes close together and the user has to be able to select a specific one.

Restrict the scanning area

Restricting the scanning area is done through the properties SBSScanSettings::activeScanningAreaLandscape and SBSScanSettings::activeScanningAreaPortrait or alternatively both can be set to the same value through setActiveScanningArea: (SBSScanSettings). Setting it directly through the orientation-sensitive properties allows you to have different scanning areas dependent on the device orientation. The area itself is specified as a rectangle with coordinates relative to the device's screen size where the top-left corner is 0/0 and the bottom-right corner is 1/1. Setting CGRectMake(0.0, 0.0, 1.0, 1.0) would set the scanning area to the entire screen. Following an example of restricting the scanning area to 100% of the screen width and 10% of the screen height centered around the middle of the screen.

SBSScanSettings *settings = [SBSScanSettings defaultSettings];
settings.activeScanningAreaPortrait = CGRectMake(0.0, 0.45, 0.01, 1.0);

Restricting the scanning area to only the bottom half of the screen would look the following way:

settings.activeScanningAreaPortrait = CGRectMake(0.0, 0.5, 0.5, 1.0);


Careful: CGRect is defined through left and top coordinates as well as a width and height which is different from how the Android RectF is defined.

Adjust the viewfinder to match the scanning area

If you reduced the size of the scanning area you likely also want to adjust the size of the viewfinder that guides the user. You can do this by setting the viewfinder dimension on the SBSOverlayController. The coordinate system here is the same as when setting the active scanning area, relative to the device's screen going from 0.0 to 1.0.

[picker.overlayController setViewfinderHeight:0.1 width:0.6 landscapeHeight:0.1 landscapeWidth:0.6];

Alternatively you can also use the new laser GUI style. This style is mostly for cases where the scanning area is restricted to a relatively low height (around 10% to 20%) as it guides to user to place the code along the laser line.