summaryrefslogtreecommitdiffstats
path: root/iphone/doc/ZBarReaderViewController.rst
blob: 4366079c1a521366d34975209e12d65d7c03c22e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
ZBarReaderViewController Class Reference
========================================

.. class:: ZBarReaderViewController

   :Inherits from: :class:`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 :class:`ZBarReaderController`.


Properties
----------

   .. member:: ZBarImageScanner *scanner

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

   .. member:: id <ZBarReaderDelegate> readerDelegate

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

   .. member:: 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
      :member:`cameraOverlayView`.  (Default ``YES``).

   .. member:: BOOL tracksSymbols

      Whether to display the tracking rectangle around detected barcodes.

   .. member:: NSUInteger supportedOrientationsMask

      Set of interface orientations that the controller should support.  Use
      :func:`ZBarOrientationMask` or ``ZBarOrientationMaskAll`` to
      generate the mask.

   .. member:: 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}}``.

   .. member:: UIView *cameraOverlayView

      A custom view to display over the camera preview.

   .. member:: CGAffineTransform cameraViewTransform

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

   .. member:: UIImagePickerControllerCameraDevice cameraDevice

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

   .. member:: UIImagePickerControllerCameraFlashMode cameraFlashMode

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

   .. member:: UIImagePickerControllerQualityType videoQuality

      The resolution to use while scanning.  Defaults to
      UIImagePickerControllerQuality640x480.

   .. member:: 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.

   .. member:: 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 :class:`ZBarReaderController` and will raise
      an exception if inappropriate/unsupported values are set.

   .. member:: UIImagePickerControllerSourceType sourceType

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

   .. member:: UIImagePickerControllerCameraCaptureMode cameraCaptureMode

      Raises an exception if anything other than
      ``UIImagePickerControllerCameraCaptureModeVideo`` is set.

   .. member:: BOOL allowsEditing

      Raises an exception if anything other than ``NO`` is set.

   .. member:: BOOL showsCameraControls

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

   .. member:: BOOL showsHelpOnFail

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

   .. member:: ZBarReaderControllerCameraMode cameraMode

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

   .. member:: 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.

   .. member:: NSInteger maxScanDimension

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


Class Methods
-------------

   .. describe:: + (BOOL) isSourceTypeAvailable:(UIImagePickerControllerSourceType)source

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

   .. describe:: + (BOOL) isCameraDeviceAvailable:(UIImagePickerControllerCameraDevice)cameraDevice

      See the :class:`UImagePickerController` method of the same name.

   .. describe:: + (BOOL) isFlashAvailableForCameraDevice:(UIImagePickerControllerCameraDevice)cameraDevice

      See the :class:`UImagePickerController` method of the same name.

   .. describe:: + (NSArray*) availableCaptureModesForCameraDevice:(UIImagePickerControllerCameraDevice)cameraDevice

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


Instance Methods
----------------

   .. _`showHelpWithReason:`:
   .. describe:: - (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 :func:`onZBarHelp` javascript function.

      :reason: A string parameter passed to javascript.

   .. _`takePicture`:
   .. describe:: - (void) takePicture

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


Macros
------

   .. function:: ZBarOrientationMask(interfaceOrientation)

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

   .. describe:: ZBarOrientationMaskAll

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