Reputation: 67
I have added AVCaptureVideoPreviewLayer to my whole view still when I'm trying to scan the barcode , it scans if i place the barcode at the centre of view. Please help me with the solution
Upvotes: 1
Views: 801
Reputation: 6885
When AVCapture scan for QRCode,there are there squares in the corners to help locate the QRCode.So you can scan for QRCode anywhere in the AVCaptureVideoPreviewLayer,and scan for more than one QRCode a time.
But there is no square to help locate barcode,instead, AVCapture scan for multiple lines which cross over the center of RectOfInterest.When a line cross over all of the lines of a Barcode,the AVCapture recognize this BarCode.So , if your barcode is in the corner of AVCaptureVideoPreviewLayer, and you don't change the default set of RectOfInterest,then you can't scan this barcode.
To fix this problem :
you can draw a Rect in the center of AVCaptureVideoPreviewLayer to hint user put barcode in the center.
set RectOfInterest at corner of AVCaptureVideoPreviewLayer,so you can only scan the barcode in the corder.
Upvotes: 4