gpt4 book ai didi

iphone - 如何访问 UIImagePickerController 上的相机闪光灯?

转载 作者:可可西里 更新时间:2023-11-01 04:21:48 25 4
gpt4 key购买 nike

我想知道如何使用 UIImagePickerController 在 iPhone 4 上打开相机闪光灯。

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerCameraDeviceFront] == YES)
{
/// What code here ///
}

else
{
NoFlash = [[UIAlertView alloc] initWithTitle:@"Uh-Oh"
message:@"Your device doesn't have a flash camera"
delegate:nil
cancelButtonTitle:@"mhmm, OK"
otherButtonTitles:nil];
NoFlash.delegate = self;
[NoFlash show];
[NoFlash release];
}

我已经在这里阅读了 UIImagePickerController 类引用网页:http://bit.ly/cdAhhB但我没有找到答案。有人可以帮帮我吗?

谢谢

最佳答案

-(void)flashSelected
{

if (PickerController.cameraFlashMode ==
UIImagePickerControllerCameraFlashModeOff) {

if ([UIImagePickerController
isFlashAvailableForCameraDevice:UIImagePickerControllerCameraDeviceRear ])

{
PickerController.cameraFlashMode =
UIImagePickerControllerCameraFlashModeOn;
}
}
else
{
PickerController.cameraFlashMode =
UIImagePickerControllerCameraFlashModeOff;
}
}

交替地..

-(void)_flashToggle
{
if (! [UIImagePickerController isFlashAvailableForCameraDevice:UIImagePickerControllerCameraDeviceRear ])
return;

if (PickerController.cameraFlashMode == UIImagePickerControllerCameraFlashModeOff)
PickerController.cameraFlashMode = UIImagePickerControllerCameraFlashModeOn;
else
PickerController.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;
}

关于iphone - 如何访问 UIImagePickerController 上的相机闪光灯?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4233100/

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