gpt4 book ai didi

ios - 如何在模拟器环境中使用 UIImagePickerController 的 CameraOverlayView 属性

转载 作者:行者123 更新时间:2023-11-29 02:47:06 27 4
gpt4 key购买 nike

我正致力于创建一个自定义相机叠加层并将其设置为 UIImagePickerController 的 CameraOverlayView 属性。

但是,由于我没有加入 Apple 的开发者计划,所以我无法在实际设备上真正部署和测试应用程序包。

我也调试了我的代码,看起来在模拟器上你不能真正选择和设置 imagePicker.sourceType 属性到 UIImagePickerControllerSourceTypeCamera。因为相机功能在模拟器上不可用。

我的想法正确吗?
还是我遗漏了一些东西,有一种方法可以设置 CameraOverlayView 属性并在模拟器上对其进行测试?

这是我的代码示例:

- (IBAction)takePicture:(id)sender
{
UIImagePickerController *imagePicker = [[UIImagePickerController alloc]init];

// Check what is possible or supported on simulator, otherwise,
//just pick from Photo library

if ( [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
}

if ( [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum]) {
imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
} else {
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}


// Allow edit
[imagePicker setEditing:YES animated:YES ];
[imagePicker setAllowsEditing:YES];
imagePicker.delegate = self;

// set custom Overlay
//imagePicker.cameraOverlayView = ( not working in simulator )

//Display the imagePicker on the screen

[self presentViewController:imagePicker animated:YES completion:NULL];
}

最佳答案

你是对的,相机在 iOS 模拟器中不工作。

关于ios - 如何在模拟器环境中使用 UIImagePickerController 的 CameraOverlayView 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24985034/

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