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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:55:00+00:00 2026-05-15T08:55:00+00:00

I am working on an iPhone application based on UITabBarController and UIViewControllers for each

  • 0

I am working on an iPhone application based on UITabBarController and UIViewControllers for each page. The app needs to run in portrait mode only, so every view controller + app delegate goes with this line of code:

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

There is one view controller where I would like to pop up a UIImageView when the iPhone is rotaed to landscapeleft. The design of the image looks landscape, although the width and height are 320×460 ( so its portrait ).

How can/should I detect this type of rotation manually, just in this specific view controller, withouth having an auto rotation on the entire view?

Thomas

UPDATE:

Thanks!

I added this listener in the viewDidLoad:

 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:)name:UIDeviceOrientationDidChangeNotification object:nil];

the didRotate looks like this:

- (void) didRotate:(NSNotification *)notification

    {   
        UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];

        if (orientation == UIDeviceOrientationLandscapeLeft)
        {
            //your code here

        }
    }
  • 1 1 Answer
  • 1 View
  • 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-05-15T08:55:01+00:00Added an answer on May 15, 2026 at 8:55 am

    I needed that in an old project – hope it still works…

    1) Register a notification:

    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(detectOrientation)
                                                 name:UIDeviceOrientationDidChangeNotification
                                               object:nil]; 
    

    2) Then you can test against the rotation on change:

    -(void) detectOrientation {
        if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) || 
            ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)) {
            [self doLandscapeThings];
        } else if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait || [[UIDevice currentDevice] orientation] == UIDeviceOrientationPortraitUpsideDown) {
            [self doPortraitThings];
        }   
    }
    

    Hope that helps!

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

Sidebar

Related Questions

I'm working on iphone application which needs to run offline at an exhibition. It
I'm working on a navigation-based iPhone-only app that serves two main purposes: One, to
I am working in tabBar based iPhone app. I have 5 UIViewControllers in tabbar
I'm working on a largely navigation-based iPhone app that communicates with a REST API
I am working on iPhone application which based on navigation controller. for example there
I am new to iPhone SDK. I am working with Tabbar based application.it has
I have a navigation based application for the iPhone that I am working that
I am working on a .NET app that will also run on iphone via
I am new to iPhone development. I am working with an navigational based application
Currently i am working on a Location based application for iPhone/iPad . I have

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.