我在使用 PBJVision 时遇到了一些问题。
我将它集成到一个 Swift 项目中,当我尝试设置预览层的框架时,它会导致框架不一致:
我有这个代码:
var _previewLayer: AVCaptureVideoPreviewLayer = PBJVision.sharedInstance().previewLayer
@IBOutlet weak var previewView: UIView! // this is the white view in the back
let bounds = self.previewView.layer.bounds
_previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
_previewLayer.bounds = bounds
_previewLayer.position = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds))
previewView.layer.addSublayer(_previewLayer)