yeahdongcn / RSBarcodes_Swift

1D and 2D barcodes reader and generators for iOS 8 with delightful controls. Now Swift.
MIT License
710 stars 185 forks source link

Active Scanning Area #43

Closed Gerst20051 closed 8 years ago

Gerst20051 commented 8 years ago

I can't seem to figure out why the barcodes are only scanned when it's in the top half of the camera feed. This is true in portrait and landscape orientation. Is this expected behavior?

yeahdongcn commented 8 years ago

The frame of the camera feed takes the bounds of the root view of RSCodeReaderViewController, maybe you should add a print in RSCodeReaderViewController's viewDidLoad()

if let videoPreviewLayer = self.videoPreviewLayer {
    videoPreviewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
    print(self.view.bounds)
    videoPreviewLayer.frame = self.view.bounds
    self.view.layer.addSublayer(videoPreviewLayer)
}
Gerst20051 commented 8 years ago

Hey, I forgot I created this issue but I figured it out. It only scans when it's directly in the center of the screen. I can be anywhere horizontally along the vertical center (equator) of the screen. If you extend the red line all the way to the edges of the screen.

img_7673

dbpfindexp commented 7 years ago

@Gerst20051 how did you get the scanning area guides to display? I would like to add something similar to help users understand the scan area.

Gerst20051 commented 7 years ago

The scan area is the horizontal red line. you can create them yourself.