我要开始说,我是objective-c和iOS编程的新手。
我想做的是将相机显示为视图的一部分,就像屏幕上方的矩形,从哪里开始?
(用于“相机视图”的GUI组件是什么?
我想做的是将相机显示为视图的一部分,就像屏幕上方的矩形,从哪里开始?
(用于“相机视图”的GUI组件是什么?
AVCamCaptureManager
还是UIImagePickerController
?)AVCamCaptureManager
还是UIImagePickerController
?)AVCaptureSession *session = [[AVCaptureSession alloc] init];
session.sessionPreset = AVCaptureSessionPreset1280x720;
然后,您必须创建输入并将其添加到会话中,以便从设备相机获取图像:
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error = nil;
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
if (!input) {
NSLog(@"Couldn't create video capture device");
}
[session addInput:input];
AVCaptureVideoPreviewLayer *newCaptureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session];