我在用戶打開應用程序時正在加載cameraview,在這裏我需要顯示掃描動畫,如條形碼掃描。有什麼方法可以使用AVCaptureSession在cameraView上顯示動畫。如何在cameraView中顯示掃描動畫
[self setCaptureSession:[[AVCaptureSession alloc] init]];
[self addVideoInputFrontCamera:NO]; // set to YES for Front Camera, No for Back camera
[self addStillImageOutput];
[self setPreviewLayer:[[AVCaptureVideoPreviewLayer alloc] initWithSession:[self captureSession]] ];
[[self previewLayer] setVideoGravity:AVLayerVideoGravityResizeAspectFill];
CGRect layerRect = [[[self view] layer] bounds];
[[self previewLayer]setBounds:layerRect];
[[self previewLayer] setPosition:CGPointMake(CGRectGetMidX(layerRect),CGRectGetMidY(layerRect))];
[[[self view] layer] addSublayer:[self previewLayer]];
[[self captureSession] startRunning];
是的,您可以在相機視圖上方設置覆蓋視圖,併爲複製條形碼的幾組圖像添加動畫掃描 – Blisskarthik
是的,我知道這一點。但我正在尋找展示掃描動畫代碼 – user3743552