0

当我使用控制器调用相机时,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];
}

请检查附件 图片在这里

4

2 回答 2

0

解决方案之一是应用缩放转换 -在堆栈上可能会有所帮助

于 2013-02-07T14:45:53.580 回答
0

我不明白你为什么要做这三件事:

[self.navigationController setNavigationBarHidden:YES];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
[self.camPicker.view setUserInteractionEnabled:YES];

或者为什么要缓存 UIImagePickerController 的实例(与在使用之间丢弃图像选择器控制器相比,这可能会导致应用程序的空闲内存使用量显着增加)。如果你不做这些事情会更好吗?

于 2013-11-20T14:27:02.450 回答