在iOS中的横向模式应用程序中使用UIImagePickerController

时间:2014-06-25 09:45:58

标签: ios iphone uiimagepickercontroller

是否可以使用UIImagePickerController从图库中获取图像,而无需在iOS中以纵向模式制作整个应用程序。谢谢

1 个答案:

答案 0 :(得分:0)

Create a custom class of UIImagePickerController. Override supportedInterfaceOrientations meted
- (NSUInteger) supportedInterfaceOrientations
{
    //Because your app is only landscape, your view controller for the view in your
    // popover needs to support only landscape
    return UIInterfaceOrientationMaskAll;
}
-(BOOL)shouldAutorotate{
    return yes;
}

//call custom view like this
   CustomImagePickerViewController *picker = [[CustomImagePickerViewController alloc] init];
        picker.supportedInterfaceOrientations= UIInterfaceOrientationMaskAll;
        picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        picker.delegate = self;
        [self presentViewController:picker animated:YES completion:nil];