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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:23:35+00:00 2026-06-08T23:23:35+00:00

I am making an iPhone app and I need it to be in portrait

  • 0

I am making an iPhone app and I need it to be in portrait mode, so if the user moves the device sideways, it does not automatically rotate. How can I do this?

  • 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-08T23:23:37+00:00Added an answer on June 8, 2026 at 11:23 pm

    To disable orientations for a particular View Controller, you should now override supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation.

    - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
        // Return a bitmask of supported orientations. If you need more,
        // use bitwise or (see the commented return).
        return UIInterfaceOrientationMaskPortrait;
        // return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
    }
    
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
        // Return the orientation you'd prefer - this is what it launches to. The
        // user can still rotate. You don't have to implement this method, in which
        // case it launches in the current orientation
        return UIInterfaceOrientationPortrait;
    }
    

    If you’re targeting something older than iOS 6, you want the shouldAutorotateToInterfaceOrientation: method. By changing when it returns yes, you’ll determine if it will rotate to said orientation. This will only allow the normal portrait orientation.

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        // Return YES for supported orientations
        return (interfaceOrientation == UIInterfaceOrientationPortrait); 
        
        // Use this to allow upside down as well
        //return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
    }
    

    Note that shouldAutorotateToInterfaceOrientation: has been deprecated in iOS 6.0.

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

Sidebar

Related Questions

I am making my first major iPhone app and need some advice in saving
I'm making an iPhone app that has information about different video games. How can
I'm making an iphone app. All you need to know is that there is
So, I'm making an iPhone app in Objective-C and need to use an array.
I am making an iPhone app wherein I need users to enter their email
I'm making a web-app for iPhone/iPod touch. And need to load in a external
I am an iPhone Developer, now I am making an App that need to
I'm making an app on the iphone and I need a way of detecting
In my iPhone app, the user will be making multiple NSStrings. Once these are
I have been making an iPhone App where I need to identify and decompose

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.