iOS 7.1 imagePicker CameraFlashMode不指示Flash状态

前端之家收集整理的这篇文章主要介绍了iOS 7.1 imagePicker CameraFlashMode不指示Flash状态前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有iPhone应用程序覆盖相机与自定义视图.
我有一个按钮来切换相机闪光模式,这是代码
switch ([self.imagePickerController cameraFlashMode]) {
    case UIImagePickerControllerCameraFlashModeAuto:
        [self.imagePickerController setCameraFlashMode:UIImagePickerControllerCameraFlashModeOn];
        return @"On";
        break;

    case UIImagePickerControllerCameraFlashModeOn:
        [self.imagePickerController setCameraFlashMode:UIImagePickerControllerCameraFlashModeOff];
        return @"Off";
        break;

    case UIImagePickerControllerCameraFlashModeOff:
        [self.imagePickerController setCameraFlashMode:UIImagePickerControllerCameraFlashModeAuto];
        return @"Auto";
        break;

    default:
        break;
}

这是我的问题:在iOS 7.0x上工作得很好,但在iOS 7.1中,cameraFlashMode属性返回UIImagePickerControllerCameraFlashModeAuto,而不管其真实状态如何.

闪光模式确实发生变化,但是我没有指示.
任何线索?
谢谢

解决方法

我这样解决了:
@property (nonatomic) NSInteger flashMode;

if (_flashMode == UIImagePickerControllerCameraFlashModeAuto)
{
    _flashMode = UIImagePickerControllerCameraFlashModeOff;
}
else if (_flashMode == UIImagePickerControllerCameraFlashModeOff)
{
    _flashMode = UIImagePickerControllerCameraFlashModeOn;
}
else if (_flashMode == UIImagePickerControllerCameraFlashModeOn)
{
    _flashMode = UIImagePickerControllerCameraFlashModeAuto;
}

_cameraPicker.cameraFlashMode = (UIImagePickerControllerCameraFlashMode)_flashMode;
原文链接:https://www.f2er.com/iOS/336187.html

猜你在找的iOS相关文章