Cannot change cameraFlashMode for UIImagePickerController iphone 4 custom cameraOverlayView

时光总嘲笑我的痴心妄想 提交于 2020-01-02 07:12:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!