问题
Question: Why imagePickerController.cameraFlashMode always returns 0 on iphone 4 and returns correct values with iphone 5 ?
I init my UIImagePickerController and set the cameraFlashMode to UIImagePickerControllerCameraFlashModeOn:
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.mediaTypes = [NSArray arrayWithObject:@"public.image"];
imagePickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
imagePickerController.showsCameraControls = NO;
imagePickerController.cameraFlashMode = UIImagePickerControllerCameraFlashModeOn;
[rest of overlay creation...]
Then when the flash button of my custom overlay is pressed, this method is fired:
As you can see in the screenshot below the value of cameraFlashMode is correct in the 'variables view' but returns 0 with NSLog and imagePickerController.cameraFlashMode
NSLog(@"current cameraFlashMode=%d", imagePickerController.cameraFlashMode); //returns 0 (iphone 4)
However on the iphone 5 the value is accessible without problem:
NSLog(@"current cameraFlashMode=%d", imagePickerController.cameraFlashMode); //returns 1 (iphone 5)
来源:https://stackoverflow.com/questions/22403092/cannot-change-cameraflashmode-for-uiimagepickercontroller-iphone-4-custom-camera