为什么我的CvVideoCamera涵盖整个视图?

时间:2013-02-05 16:40:22

标签: ios opencv storyboard

我正在使用CvVideo Camera:

- (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];
}

我的故事板看起来像这样:

enter image description here

当视图加载时,条形图会短暂可见,其余视图为白色。然后当相机启动时,它会填满整个屏幕。为什么要这样做?

1 个答案:

答案 0 :(得分:0)

你尝试过不同的父视图吗?

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