3.5. ZBarReaderView Class Reference

class ZBarReaderView
Inherits from:UIView

This is a barcode reader encapsulted in a UIView. It manages an AVCaptureSession with a camera device and a ZBarCaptureReader, presents the video preview and optionally tracks detected barcode symbols. A delegate will usually be assigned for notification of new decode results.

3.5.1. Properties

id<ZBarReaderViewDelegate> readerDelegate

The delegate that will be notified of new decode results.

ZBarImageScanner* scanner

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

BOOL tracksSymbols

Whether to display the tracking annotation (default YES).

UIColor* trackingColor

The color of the tracking annotation (default green).

BOOL allowsPinchZoom

Enable pinch gesture recognition for manually zooming the preview/decode (default YES).

NSInteger torchMode

An AVCaptureTorchMode value that will be applied if/when appropriate. (default Auto)


Overlay the decode frame rate on the preview to help with performance optimization. This is for debug only and should not be set for production. (default NO)

CGFloat zoom

Zoom scale factor applied to the video preview and scanCrop. This value is also updated by the pinch-zoom gesture. Valid values are in the range [1,maxZoom]. (default 1.25)

CGFloat maxZoom

Maximum settable zoom level. The zoom property will be clipped to this value.

CGRect scanCrop

The region of the video image that will be scanned, in normalized image coordinates. Note that the video image is in landscape mode (default {{0, 0}, {1, 1}})

CGAffineTransform previewTransform

Additional transform that will be applied to the video preview. Note that this transform is not applied to scanCrop.

AVCaptureDevice* device

The capture device may be manipulated or replaced.

AVCaptureSession* session

Direct access to the capture session. Warranty void if opened. (read-only)

ZBarCaptureReader* captureReader

Direct access to the capture reader. Warranty void if opened. (read-only)

BOOL enableCache
Deprecated :

Whether to use the inter-frame consistency cache. This should always be set to YES.

3.5.2. Instance Methods

- (id) initWithImageScanner:(ZBarImageScanner*)imageScanner
Imagescanner :A pre-configured ZBarImageScanner to use for scanning
Returns :The initialized ZBarReaderView
- (void) start

Begin/resume scanning after a call to stop.

- (void) stop

Stop scanning and pause the video feed.

- (void) flushCache

Flush the inter-frame consistency cache. Any barcodes in the frame will be re-recognized in subsequent frames.

- (void) setZoom:(CGFloat)zoom animated:(BOOL)animated

Set the zoom property with optional animation.

- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration

Compensate for device / camera / interface orientation. Must be called by containing view controller that supports any non-portrait orientation to restore the camera preview to the correct orientation. Call from view controller method of the same name for correct animation.

Table Of Contents

Previous topic

3.4. ZBarReaderDelegate Protocol Reference

Next topic

3.6. ZBarReaderViewController Class Reference