Video Preview Frame Size
Developers working with our Barcode Reader SDK for IOS may have noticed that the video preview window no longer fills the entire screen in our example XCode project. The following screen shot shows the problem with out the bars at the top and bottom of the screen…
To make the preview screen fill the entire screen (or at least the entire size of the delegates view) and do the following:
- Edit the Bardecode.m source file.
- Search for ResizePreview function.
- Locate the line “PreviewLayer.frame= aView.bounds;” and replace with the following code.
CGRect bounds=aView.layer.bounds;
PreviewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
PreviewLayer.bounds=bounds;
PreviewLayer.position=CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds));