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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:16:33+00:00 2026-06-10T11:16:33+00:00

I updated to Xcode 4.5 and am working with iOS6–a mistake I will definitely

  • 0

I updated to Xcode 4.5 and am working with iOS6–a mistake I will definitely not make next time there’s an update; it’s been sort of nightmarish for somebody so new to iOS–and I’ve just noticed an app I’m working on is autorotating. I never noticed it autorotatin before the update, but it’s also possible I just didn’t rotate the phone while testing, so I can’t be sure. I’ve added the following code to the main UIViewController and it’s still rotating:

- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation
{
    return NO;
}

Is this the right way to disable autorotation? If it is, then maybe there’s some change in iOS6 and I’ll have to wait until the full release to find out. But if I’ve gotten it wrong, what code should I use instead?

Thanks, as always, for your help.

EDIT: Here’s the code I changed it to, but it’s still rotating. Have I gotten it wrong?

- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationPortrait)
{
    return YES;
}
else 
{
    return NO;
}
}
  • 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-10T11:16:34+00:00Added an answer on June 10, 2026 at 11:16 am

    that is because there was never a success. You should choose one of the orientations.

    Hold command and click on UIInterfaceOrientation you will see an enumeration of the possible options.

    then you can test against those to decide your YES Scenario.

    I may have originally misunderstood your problem. It seems that you may have been saying that your app is allowing rotation. but the code should disallow that.

    I was thinking you were saying it was still firing the code. Trying to find a Yes

    One thing to think about. is there may be more than one view controller available. perhaps your code is not being hit.

    A couple of possible issues for this.

    1. Your code is not even being used. because the view is being allocated as UIViewController as opposed to your custom view controller.

    2. You code is being used but that View controller is not the one being asked about the Orientation. therefore that specific code is not being hit.

    3. A bad build keeps putting the wrong assemblies onto the device.

    Your solutions can be as follows.

    1. Ensure your code is the one being allocated. Either there is a direct alloc on your custom class. or the xib file is inflating it. Check out the Identity Inspector when you have your xib file open. select your View Controller and ensure that custom class is set to your class type

    2. Look at the hierarchy. what other view controllers are there. Perhaps one of those are telling the app it can autorotate to any orientation.

    3. Find your “DerivedData” folder and remove it entirely. Sometimes this works from the organizer. other times you need to delete directly off the disk. Then clean and build again.

    Also another solution could be as simple as setting the settings in the Project file.

    Select your project file from the file browser and you will see the iPad and iPod settings in the summary. You can “UnPress” buttons for the orientations that you want to disallow. and any view controllers that you do not otherwise code orientation into. will use these by default.

    My apologies for the confusion.

    Update

    I commonly use this code to handle my autorotation.

    It not only differentiates the ipad from the other ios devices, but it also forwards the request onto presented controllers so a view that is shown modal may respond how it wants.

    Orientation is a pain when you dont understand it 🙂

    // Detect iPad
    #define IS_IPAD() ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] ? \
    [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad : NO)
    
    // Set preferred orientation for initial display
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
        if (IS_IPAD()){
            return UIInterfaceOrientationLandscapeRight;
        }
        else {
            return UIInterfaceOrientationPortrait;
        }
    }
    // Return list of supported orientations.
    - (NSUInteger)supportedInterfaceOrientations{
        if (self.presentedViewController != nil){
            return [self.presentedViewController supportedInterfaceOrientations];
        }
        else {
            if (IS_IPAD()){
                return UIInterfaceOrientationMaskLandscapeRight;
            }
            else {
                return UIInterfaceOrientationMaskAll;
            }
        }
    }
    
    // Determine iOS 6 Autorotation.
    - (BOOL)shouldAutorotate{
        UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
        // Return yes to allow the device to load initially.
        if (orientation == UIDeviceOrientationUnknown) return YES;
        // Pass iOS 6 Request for orientation on to iOS 5 code. (backwards compatible)
        BOOL result = [self shouldAutorotateToInterfaceOrientation:orientation];
        return result;
    }
    // handle iOS 5 Orientation as normal
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
        // Return YES for supported orientations
    
        if (self.presentedViewController != nil){
            return [self.presentedViewController shouldAutorotate];
        }
        else {
            if (IS_IPAD()){
                return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
            }
            else {
                return (interfaceOrientation == UIInterfaceOrientationPortrait);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I updated my xcode version to 4.2 and about to make a universal application
I've been working on an iPhone project with iOS 4.0. I just downloaded Xcode
When you update Xcode to 3.2.4, your previously working Xcode iOS project gives you
Update: if you've added symbolic breakpoints and they're not working, uh, wait awhile. After
I've recently updated xcode to 4.3.3 with osx sdk 10.7.4 in it. After that
I recently updated xcode to 4.3.2 on my macbook via the app store. Because
I recently updated to the new version of XCode and the session start code
Since recent update Xcode 4.3 now seems to default to LLDB debugger. I just
I'm looking to find information on how to update my XCode program that has
I'm using Xcode 4.3.2 and it tried to install an update to the command

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.