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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:38:52+00:00 2026-05-23T00:38:52+00:00

I am trying to run some code in my iPhone app when the device

  • 0

I am trying to run some code in my iPhone app when the device is rotated left or right.
Clearly, I can do this using shouldAutorotateToInterfaceOrientation, However, I DO NOT want to rotate the controls/subviews on the view. I can stop the subviews from rotating by returning NO to the above method:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {    
    NSLog(@"Should rotate\n");
    return YES;
}

When I do this and rotate the device left or right, the event fires as expected. My problem is, when I rotate back from landscape to portrait, the event isn’t fired. This has to be because the rotation was stopped by returning NO before it was rotated to lanscape; so the orientation is still considered portrait. However, if I return YES, the subviews rotate.

Has anyone dealt with this issue? Does anyone know a way to either (1) return YES with shouldAutorotateToInterfaceOrientation while keeping the controls static, or (2) capture the device rotation independent of shouldAutorotateToInterfaceOrientation?

Many thanks,
Brett

  • 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-05-23T00:38:53+00:00Added an answer on May 23, 2026 at 12:38 am

    If you need to just follow the device rotations, you can do this by listening for UIDeviceOrientationDidChangeNotification notification and then getting the current orientation using the orientation property of the UIDevice singleton. You will have to start and stop these notifications by calling beginGeneratingDeviceOrientationNotifications and endGeneratingDeviceOrientationNotifications on the UIDevice object.

    This way you can return YES only for the orientation you want the controls to be in and yet follow device orientation changes.

    While the purpose isn’t clear, if this is for a game you should look at CoreMotion framework and follow the gyro-meter data.

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

Sidebar

Related Questions

I am newbie with JPA. I'm trying to run some sample code using JPA
I'm trying to run some basic javascript code with JSF 2. I'm using the
in my app I am trying to run some code that currently exists in
I'm trying to run some python code under Apache 2.2 / mod_python 3.2.8. Eventually
Where would set_include_path(../../); point to? I am trying to run some PHP code on
I'm trying to use Python to run pdftotext, but for some reason, my code
I'm trying to run some commands in paralel, in background, using bash. Here's what
I am trying to run some unix commands from my java code. I am
I'm trying to always run some code after .find or .where or whatever is
I am trying to run some code from a book . There appears to

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.