gpt4 book ai didi

ios - 为什么我的 CvVideoCamera 会覆盖整个 View ?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:43:12 34 4
gpt4 key购买 nike

因此我正在使用 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];
}

我的 Storyboard是这样的:

enter image description here

当 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/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com