gpt4 book ai didi

ios 7.1 flash 模式不工作

转载 作者:行者123 更新时间:2023-11-28 18:10:36 27 4
gpt4 key购买 nike

这是我在 iphone 上更改闪光灯模式的代码。

在ios7.0中工作:flashmode(0,1,-1)

在 ios7.1 中不工作:flashmode(0,0,0)

//UIImagePickerControllerCameraFlashModeOff  = -1,
//UIImagePickerControllerCameraFlashModeAuto = 0,
//UIImagePickerControllerCameraFlashModeOn = 1

NSInteger flashMode = self.pickerReference.cameraFlashMode;

NSLog(@"flashmode %i",flashMode);

if (flashMode == UIImagePickerControllerCameraFlashModeAuto) {
[(UIButton *)sender setImage:[UIImage imageNamed:@"flashYesComposeButton.png"] forState:UIControlStateNormal];
self.pickerReference.cameraFlashMode = UIImagePickerControllerCameraFlashModeOn;
}

else if (flashMode == UIImagePickerControllerCameraFlashModeOn) {
[(UIButton *)sender setImage:[UIImage imageNamed:@"flashNoComposeButton.png"] forState:UIControlStateNormal];
self.pickerReference.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;
}

else if (flashMode == UIImagePickerControllerCameraFlashModeOff)
{
[(UIButton *)sender setImage:[UIImage imageNamed:@"flashAutoComposeButton.png"] forState:UIControlStateNormal];
self.pickerReference.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
}

最佳答案

我之前遇到过那个错误

问题是无论 ios 7.1 中的真实闪光状态是什么,它总是返回 UIImagePickerControllerCameraFlashModeAuto。有趣的是,如果你将闪光灯模式设置为UIImagePickerControllerCameraFlashModeOff,闪光灯会真正关闭,但如果你询问状态,它仍然是UIImagePickerControllerCameraFlashModeAuto

所以我通过保留自己的“flashState”解决了我的问题。单击时,我手动更改自己的状态,除了 UIImagePickerController 之外,我从不相信发回的状态。

@property (nonatomic) UIImagePickerControllerCameraFlashMode flashMode;

点击按钮时:

       if (self.flashMode == UIImagePickerControllerCameraFlashModeAuto) {  
//toggle your button to "on"
self.flashMode = UIImagePickerControllerCameraFlashModeOn;
}else if (self.flashMode == UIImagePickerControllerCameraFlashModeOn){
//toggle your button to "Off"
self.flashMode = UIImagePickerControllerCameraFlashModeOff;
}else if (self.flashMode == UIImagePickerControllerCameraFlashModeOff){
//toggle your button to "Auto"
self.flashMode = UIImagePickerControllerCameraFlashModeAuto;
}

关于ios 7.1 flash 模式不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23156163/

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