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 9182063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:28:18+00:00 2026-06-17T18:28:18+00:00

My application is set in info.plist to support only portrait mode. However, the UIImagePickerController,

  • 0

My application is set in info.plist to support only portrait mode.

However, the UIImagePickerController, rotates when the user rotates the screen to landscape.

Since in io6 the method shouldAutoRotate is not being called, I tried to extend it like this:

@interface NonRotatingUIImagePickerController : UIImagePickerController

@end

@implementation NonRotatingUIImagePickerController

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;

}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationMaskPortrait;
}

@end 

But it doesn’t help. Any idea why?

And in the log I see the above methods being called. The UIImagePickerController at first is displayed in portrait and when the user rotates – it rotates as well instead of staying portrait.

I set the image picker in the view like this:

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (!self.imagePickerController) {
        self.imagePickerController = [[NonRotatingUIImagePickerController alloc] init];
        self.imagePickerController.delegate = self;
    }
    return self;
}

- (void)viewDidAppear:(BOOL)animated{
   self.imagePickerController.showsCameraControls = NO;
   CGRect imagePickerControllerFrame = CGRectMake(0, topBar.frame.size.height, self.view.frame.size.width, self.view.frame.size.height - topBar.frame.size.height - bottomBar.frame.size.height);
   self.imagePickerController.view.frame = imagePickerControllerFrame;
   self.imagePickerController.allowsEditing = YES;
   self.imagePickerController.view.clipsToBounds = YES;
  self.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera
  [self.view.window addSubview:self.imagePickerController.view];
}
  • 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-17T18:28:19+00:00Added an answer on June 17, 2026 at 6:28 pm
    self.imagePickerController.view.frame = imagePickerControllerFrame;
    // ...
    [self.view.window addSubview:self.imagePickerController.view];
    

    Well, that’s all totally illegitimate. Apple makes this very clear in the docs:

    This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified

    There is only one correct way to use an image picker controller that uses UIImagePickerControllerSourceTypeCamera – as a fullscreen presented view controller:

    BOOL ok = [UIImagePickerController isSourceTypeAvailable:
               UIImagePickerControllerSourceTypeCamera];
    if (!ok) {
        NSLog(@"no camera");
        return;
    }
    NSArray* arr = [UIImagePickerController availableMediaTypesForSourceType:
                    UIImagePickerControllerSourceTypeCamera];
    if ([arr indexOfObject:(NSString*)kUTTypeImage] == NSNotFound) {
        NSLog(@"no stills");
        return;
    }
    UIImagePickerController* picker = [UIImagePickerController new];
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.mediaTypes = @[(NSString*)kUTTypeImage];
    picker.delegate = self;
    [self presentViewController:picker animated:YES completion:nil];
    

    If you want to present a live picture-taking interface inside your own interface, use AVFoundation and the camera capture API that it gives you.

    Downloadable working example here:

    https://github.com/mattneub/Programming-iOS-Book-Examples/blob/master/ch30p816cameraCaptureWithAVFoundation/p683cameraCaptureWithAVFoundation/ViewController.m

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am preparing Info.plist for my iOS application. I want to carefully set each
My application has a main nib defined in the info.plist. This nib includes a
I'm creating an iPad application that supports ONLY LANDSDCAPE mode. I'm using storyboards. Even
- (void) applicationDidFinishLaunching:(UIApplication *)application { //set up main loop [NSTimer scheduledTimerWithTimeInterval:0.033 target:self selector:@selector(gameLoop:) userInfo:nil
So I have a XNA application set up. The camera is in first person
This does NOT work: Sub X() Dim A As Access.Application Set A = CreateObject(Access.Application)
I have the update frequency of my ClickOnce application set to weekly. What is
Can the application use set same char in the XON and XOFF? If yes,
I need my application installer set the program to auto-startup for all users. Then
We have Tomcat application server set up at port 8080 and Apache Http Server

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.