I am working on an application that the user can choose if he wants to scan a barcode or do something. In order to take a picture, I use UIImagePickerController, as usual. To scan the barcode, I use ZbarSDK 1.2 ZBarReaderViewController.
When shooting, everything works fine. When scanning a barcode: If you run the application and scan the barcode before by taking a picture, it also works great.
But you take a picture, and then go back and try to scan the barcode, the camera loses autofocus, and it is simply impossible to scan the barcode.
To summarize:
Start → Scan → Autofocus Start → Take a photo → Back → Scan → Auto focus does not work
Here's how I initialize the barcode scanner:
-(ZBarReaderViewController *) barcodeScanner
{
if (nil == _barcodeScanner)
{
_barcodeScanner = [ZBarReaderViewController new];
_barcodeScanner.readerDelegate = self;
_barcodeScanner.cameraMode = ZBarReaderControllerCameraModeSampling;
_barcodeScanner.sourceType = UIImagePickerControllerSourceTypeCamera;
}
return _barcodeScanner;
}
Any ideas?
source
share