问题:为什么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按钮时,会触发此方法:
正如您在下面的屏幕截图中所看到的,在变量视图中,cameraFlashMode的值是正确的'但是使用NSLog和imagePickerController.cameraFlashMode
返回0NSLog(@"current cameraFlashMode=%d", imagePickerController.cameraFlashMode); //returns 0 (iphone 4)
然而,在iphone 5上,可以毫无问题地访问该值:
NSLog(@"current cameraFlashMode=%d", imagePickerController.cameraFlashMode); //returns 1 (iphone 5)