无法更改cameraFlashMode for UIImagePickerController iphone 4自定义cameraOverlayView
问题 : 为什么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...]
然后当按下我的自定义叠加层的闪光按钮时,会触发此方法:
正如您在下面的屏幕截图中看到的,cameraFlashMode的值在“变量视图”中是正确的,但在NSLog和imagePickerController.cameraFlashMode中返回0
NSLog(@"current cameraFlashMode=%d", imagePickerController.cameraFlashMode); //returns 0 (iphone 4)
但是在iphone 5上可以正常访问该值:
NSLog(@"current cameraFlashMode=%d", imagePickerController.cameraFlashMode); //returns 1 (iphone 5)