10

http://developer.apple.com/iphone/library/qa/qa2010/qa1702.htmlに従って、AVCaptureSessionを使用してカメラからビデオフレームをキャプチャすることができました。ただし、AVCaptureScreenは、画面にカメラストリームを表示せずに、カメラからフレームをキャプチャしているようです。UIImagePickerと同じようにカメラストリームも表示して、ユーザーがカメラの電源がオンになっていることを認識し、カメラが何を指しているかを確認できるようにします。ヘルプやポインタをいただければ幸いです。

4

1 に答える 1

19

AVCaptureVideoPreviewLayerはまさにあなたが探しているものです。

Appleが使用方法を示すために使用するコードフラグメントは次のとおりです。

AVCaptureSession *captureSession = <#Get a capture session#>;
AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:captureSession];
UIView *aView = <#The view in which to present the layer#>;
previewLayer.frame = aView.bounds; // Assume you want the preview layer to fill the view.
[aView.layer addSublayer:previewLayer];
于 2010-08-02T02:10:49.030 に答える