Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9170985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:06:06+00:00 2026-06-17T16:06:06+00:00

I work on iPad 4 with iOS 6.0. I have a ViewController (MyPickerController) with

  • 0

I work on iPad 4 with iOS 6.0.

I have a ViewController (MyPickerController) with the following init:

- (id)init
{
    self = [super init];
    if (self) {
        _picker = [[UIImagePickerController alloc] init];
        _picker.delegate = self;
        _picker.sourceType = UIImagePickerControllerSourceTypeCamera;
        [self.view addSubview:_picker.view];
    }
    return self;
}

I implement the following UIPickerControllerDelegate method to dimiss MyPickerController:

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

Well, I have another view controller showed modally in FormSheetStyle and when I tap on a button I want to show MyPickerController with the following code:

MyPickerController * pickerVC = [[MyPickerController alloc] init];
[self presentViewController:pickerVC animated:YES completion:nil];

In my AppDelegate i Have the following totation method:

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    
    return (NSUInteger)[application supportedInterfaceOrientationsForWindow:window] | (1<<UIInterfaceOrientationPortrait);
    
}

When I tap on cancel button of UIIMagePicker into MyPickerController, the application crashes with the following error:

Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'preferredInterfaceOrientationForPresentation must return a supported interface orientation!

Reading related questions on stackoverflow, I create also the follwing UIImagePickerController category:

@implementation UIImagePickerController (NonRotating)

- (BOOL)shouldAutorotate
{
    return NO;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationMaskPortrait;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

@end

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:06:07+00:00Added an answer on June 17, 2026 at 4:06 pm

    Try doing this..

    If your view controller is inside a UINavigationController, you should use this category for the navigationcontroller:

    @implementation UINavigationController (autorotate)
    
    - (NSUInteger)supportedInterfaceOrientations{
          return UIInterfaceOrientationMaskAll;
    }
    
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
          return UIInterfaceOrientationMaskPortrait;
    }
    
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I work with Xcode 4.3 for a iPad iOS 5 project. I am performing
Is there a way to have the file reference work under ipad? The file
I am trying to get a UIScrollView on an iPad to work. I have
So this is my first time I have to work with the IPad camera
I have a swf file on my site and it doesn't work on Iphone/Ipad
On an iPad with iOS 6 GM. I have 6 UITextFields, 3 UITextViews, and
We have an iPad/iPhone enabled web application which was working good on iOS 5.1
I'm a iOS developer. I have developed many apps for iPhone and iPad. Now
I have a problem to run application in my iPad(5.1.1) . I work with
Up in viewDidLoad I have: UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)]; For

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.