当我使用UIimagepicker
控制器调用相机时,它在iOS版本4.2的iPhone上不会以全屏模式显示,但它在iOS 5中可以正常工作。
有人能告诉我需要更改的代码以及现有代码的问题是什么?
我使用以下代码:
- (IBAction)takePicture:(id)sender
{
UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.showsCameraControls = YES;
imagePicker.allowsEditing = NO;
imagePicker.toolbarHidden = YES;
imagePicker.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
imagePicker.wantsFullScreenLayout = YES;
if ([UIImagePickerController respondsToSelector:@selector(isCameraDeviceAvailable:)])
{
if ([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront])
{
[imagePicker setCameraDevice:UIImagePickerControllerCameraDeviceFront];
}
}
// Show the camera UI and View Finder.
[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];
}
请检查附件 Image is here
答案 0 :(得分:0)
其中一个解决方案是应用缩放转换 - here on stack也许它会有所帮助
答案 1 :(得分:0)
我不明白你为什么要做这三件事:
[self.navigationController setNavigationBarHidden:YES];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
[self.camPicker.view setUserInteractionEnabled:YES];
或者就此而言,为什么要缓存UIImagePickerController的实例(与使用之间丢弃图像选择器控制器相比,这可能会导致应用程序的空闲内存使用量显着增加)。 如果你不做这些事情会更好吗?