0

is it possible to use UIImagePickerController to fetch image from gallery without making whole app in portrait mode in iOS .Thanks

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • check out this answer : http://stackoverflow.com/questions/20743388/is-it-possible-to-show-uiimagepickercontroller-in-iphone-in-landscape-mode – Naga Mallesh Maddali Jun 25 '14 at 10:07
  • Problem solved by creating category class of NavigationController and adding function -(BOOL)shouldAutorotate { return NO; } – user3587934 Jun 25 '14 at 11:55

1 Answers1

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];
user3663584
  • 100
  • 6