gpt4 book ai didi

ios - 来自 xib 的 cameraOverlayView

转载 作者:行者123 更新时间:2023-11-29 12:39:58 26 4
gpt4 key购买 nike

我已经搜索了一段时间,但似乎找不到一个明确的方法来做到这一点。我找到的任何链接都已过时。我正在展示这样的相机

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.


//Get the camera
self.imagePicker = [[UIImagePickerController alloc] init];
self.imagePicker.delegate = self;
self.imagePicker.allowsEditing = NO;
self.imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.imagePicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:self.imagePicker.sourceType];
self.imagePicker.showsCameraControls = NO;
self.imagePicker.wantsFullScreenLayout = YES; //<-- This does not work in iOS7


//set our custom overlay view


[self presentViewController:self.imagePicker animated:NO completion:nil];

}

我有一个 ViewController 连接到名为 ControllsViewController 的 xib。我不知道如何将它分配给 self.imagePicker.cameraOverlayView = 。有人可以帮我吗?

最佳答案

您需要使用 xib 实例化 ControllsViewController。假设您的主包中有一个名为“ControllsViewController”的 xib 文件:

ControllsViewController *overlayViewController = [ControllsViewController alloc] initWithNibName:@"ControllsViewController" bundle:nil];
self.imagePicker.cameraOverlayView = overlayViewController.view;

您可能想将 overlayViewController 分配给一个属性以保留它。

关于ios - 来自 xib 的 cameraOverlayView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25254316/

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