无法更改cameraFlashMode for UIImagePickerController iphone 4自定义cameraOverlayView

时间:2014-03-14 10:56:59

标签: ios uiimagepickercontroller iphone-4

问题为什么imagePickerController.cameraFlashMode总是在iphone 4上返回0并使用iphone 5返回正确的值?

我初始化我的UIImagePickerController并将cameraFlashMode设置为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...]

然后按下我的自定义叠加层的flash按钮时,会触发此方法: enter image description here

正如您在下面的屏幕截图中所看到的,在变量视图中,cameraFlashMode的值是正确的'但是使用NSLog和imagePickerController.cameraFlashMode

返回0
NSLog(@"current cameraFlashMode=%d", imagePickerController.cameraFlashMode); //returns 0 (iphone 4)

log and console debug from iphone4

然而,在iphone 5上,可以毫无问题地访问该值:

NSLog(@"current cameraFlashMode=%d", imagePickerController.cameraFlashMode); //returns 1 (iphone 5)

0 个答案:

没有答案