3.6. ZBarReaderViewController Class Reference

class ZBarReaderViewController
Inherits from:UIViewController

This is the controller to use for live scanning from the camera feed with automatic capture. For scanning from image files or with manual capture, see ZBarReaderController.

3.6.1. Properties

ZBarImageScanner* scanner

Access to the image scanner for configuration. (read-only)

id<ZBarReaderDelegate> readerDelegate

The delegate that will be notified when new barcode results are available.

BOOL showsZBarControls

Whether to display a default control set consisting of cancel, scan and info buttons. Disable these if you provide your own controls using the cameraOverlayView. (Default YES).

BOOL tracksSymbols

Whether to display the tracking rectangle around detected barcodes.

NSUInteger supportedOrientationsMask

Set of interface orientations that the controller should support. Use ZBarOrientationMask() or ZBarOrientationMaskAll to generate the mask.

CGRect scanCrop

Crop images before scanning. The original image will be cropped to this rectangle, which should be in normalized image coordinates (NB the camera image x-axis is vertical on the screen). Defaults to the full image {{0, 0}, {1, 1}}.

UIView* cameraOverlayView

A custom view to display over the camera preview.

CGAffineTransform cameraViewTransform

A transform to apply to the camera preview. Ignored by the reader.

UIImagePickerControllerCameraDevice cameraDevice

The camera device to use for scanning. Defaults to the system default camera.

UIImagePickerControllerCameraFlashMode cameraFlashMode

The “flash” (aka torch) mode to use while scanning. Defaults to UIImagePickerControllerCameraFlashModeAuto.

UIImagePickerControllerQualityType videoQuality

The resolution to use while scanning. Defaults to UIImagePickerControllerQuality640x480.

ZBarReaderView* readerView

View that presents the camera preview and performs the scanning. This view has other properties you may use to control the appearance and behavior of the reader.

Note that this view may be released when it is not displayed (eg, under low memory conditions). You should apply any configuration just before you present the reader.

BOOL enableCache

This property is deprecated and should not be modified.

Warning

The remaining properties are deprecated, they are only present for backward compatibility with ZBarReaderController and will raise an exception if inappropriate/unsupported values are set.

UIImagePickerControllerSourceType sourceType

Raises an exception if anything other than UIImagePickerControllerSourceTypeCamera is set. If you want to scan images, use a ZBarReaderController instead of this class.

UIImagePickerControllerCameraCaptureMode cameraCaptureMode

Raises an exception if anything other than UIImagePickerControllerCameraCaptureModeVideo is set.

BOOL allowsEditing

Raises an exception if anything other than NO is set.

BOOL showsCameraControls

Raises an exception if anything other than NO is set. Use showsZBarControls to disable the buit-in overlay.

BOOL showsHelpOnFail

Any value set to this property is ignored. It is only useful for scanning images, for which you should use ZBarReaderController.

ZBarReaderControllerCameraMode cameraMode

This reader only supports scanning from the camera feed. If you want to scan manually captured images, use a ZBarReaderController instead of this class.

BOOL takesPicture

Raises an exception if anything other than NO is set. This controller automatically returns the scanned camera frame and does not support capturing a separate image.

NSInteger maxScanDimension

Any value set to this property is ignored. It is only useful for scanning images, for which you should use ZBarReaderController.

3.6.2. Class Methods

+ (BOOL) isSourceTypeAvailable:(UIImagePickerControllerSourceType)source

Returns YES only if source is Camera and the UImagePickerController method of the same name also returns YES.

+ (BOOL) isCameraDeviceAvailable:(UIImagePickerControllerCameraDevice)cameraDevice

See the UImagePickerController method of the same name.

+ (BOOL) isFlashAvailableForCameraDevice:(UIImagePickerControllerCameraDevice)cameraDevice

See the UImagePickerController method of the same name.

+ (NSArray*) availableCaptureModesForCameraDevice:(UIImagePickerControllerCameraDevice)cameraDevice

Returns an array with the single element UIImagePickerControllerCameraCaptureModeVideo if the device is avilable, otherwise returns an empty array.

3.6.3. Instance Methods

- (void) showHelpWithReason:(NSString*)reason

Display the integrated help browser. Use this with custom overlays if you don’t also want to create your own help view. Should only be called when the reader is displayed. The reason argument will be passed to the onZBarHelp() javascript function.

Reason :A string parameter passed to javascript.
- (void) takePicture

Capture the next available frame and send it over the usual delegate path.

3.6.4. Macros

ZBarOrientationMask(interfaceOrientation)

Generate a bit-mask for the specified interface orientation, suitable for setting supportedOrientationsMask.

ZBarOrientationMaskAll

Combination of ZBarOrientationMask() for all interface orientations (Portrait, PortraitUpsideDown, LandscapeLeft and LandscapeRight)