iOS 7.1 imagePicker CameraFlashMode not indicating Flash state

前端 未结 4 2057
隐瞒了意图╮
隐瞒了意图╮ 2021-02-19 20:36

I have iPhone application which overlays the camera with custom view. I have a button to switch between camera flash mode, this is the code

switch ([self.imagePi         


        
4条回答
  •  花落未央
    2021-02-19 21:26

    I solved it like this:

    @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;
    

提交回复
热议问题