gpt4 book ai didi

ios - 设置相机闪光灯在iOS 10中不起作用

转载 作者:行者123 更新时间:2023-12-01 19:59:55 25 4
gpt4 key购买 nike

无法为iOS 10及更高版本正确设置相机闪光灯(这在iOS 9中正常运行)。它始终默认为UIImagePickerControllerCameraFlashModeAuto。

这是我的代码:

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
[picker setAllowsEditing:NO];
[picker setDelegate:self];
[picker setSourceType:UIImagePickerControllerSourceTypeCamera];
[picker setCameraFlashMode:UIImagePickerControllerCameraFlashModeOn];
[picker setCameraOverlayView:overlayView];
[self presentViewController:picker animated:YES completion:Nil];

最佳答案

所以我想我必须等待UIImagePickerController渲染并再次设置相机闪光灯。

所以我更新了

[self presentViewController:picker animated:YES completion:nil];


[self presentViewController:picker animated:YES completion:^{
//For iOS 10 and higher versions so it can set the proper flashmode
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10) {
[picker setCameraFlashMode:UIImagePickerControllerCameraFlashModeOn];
}
}];

希望这会有所帮助。

关于ios - 设置相机闪光灯在iOS 10中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40312029/

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