我正在使用CvVideo摄像机,因此:

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView];
    self.videoCamera.delegate = self;
    self.videoCamera.defaultAVCaptureDevicePosition = AVCaptureDevicePositionBack;
    self.videoCamera.defaultAVCaptureSessionPreset = AVCaptureSessionPresetiFrame960x540;
    self.videoCamera.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationPortrait;
    self.videoCamera.defaultFPS = 30;
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [self.videoCamera start];
}

我的 Storyboard如下所示:

加载 View 时,该栏会短暂可见,其余 View 为白色。然后,当相机启动时,它会充满整个屏幕。为什么这样做呢?

最佳答案

您是否尝试过使用其他父 View ?

UIView *camView = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 300, 400)];
[self.view addSubview:camView];
self.videoCamera = [[CvVideoCamera alloc] initWithParentView:camView];

关于ios - 为什么我的CvVideoCamera可以覆盖整个 View ?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14712444/

10-09 15:34