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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:27:08+00:00 2026-06-02T22:27:08+00:00

I realize there a many questions relating to this issue, however i have not

  • 0

I realize there a many questions relating to this issue, however i have not found one that solves my issue.

To start, I have set this code in my menu.h

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

The status bar changes with orientation but the views are not rotating or resizing. In order to try to narrow down my issue, I decided to try to switch two views within one .xib based on orientation

    - (void)viewDidLoad {
    [super viewDidLoad];

    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
     }
    -(void) orientationChanged:(NSNotification *)object
{
   UIDeviceOrientation deviceOrientation = [[object object] orientation];

    if (deviceOrientation == UIDeviceOrientationLandscapeLeft || deviceOrientation == UIDeviceOrientationLandscapeRight)
    {
        self.view = self.landscapeView;
    }
    else 
    {
        self.view = self.portraitView;
    }
}

In the iOS simulator, the view definitely changes to the specific views. However the landscape view shows up as if it was portrait and sideways.

my landscape view in IB
enter image description here

My landscape view in the iOS simulator after changing orientation
enter image description here

What am I doing wrong here? I can’t figure it out, any help would be greatly appreciated. Thank you in advance.
** EDIT: New Code Below **
Okay.. my issue is that the view loads properly in landscape, it’s just sideways. So the Landscape view loads, just sideways. My revised code based on @Seega is:

- (void)viewDidLoad {
    [super viewDidLoad];
    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:@"UIDeviceOrientationDidChangeNotification" object:nil];

    [[TTNavigator navigator] setCustomTarget:self];
    [[TTNavigator navigator] setCustomAction:@selector(photoAction)];
}

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    if (toInterfaceOrientation == UIDeviceOrientationLandscapeLeft || toInterfaceOrientation == UIDeviceOrientationLandscapeRight)
    {
        self.view = self.landscapeView;
    }
    else 
    {
        self.view = self.portraitView;
    }
}

-(void) orientationChanged:(NSNotification *)object
{
    UIDeviceOrientation deviceOrientation = [[object object] orientation];

    if (deviceOrientation == UIDeviceOrientationLandscapeLeft || deviceOrientation == UIDeviceOrientationLandscapeRight)
    {
        self.view = self.landscapeView;
    }
    else 
    {
        self.view = self.portraitView;
    }
}
  • 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-02T22:27:10+00:00Added an answer on June 2, 2026 at 10:27 pm

    Hey thank you all for your help. I had a friend help and am not entirely sure was the problem. I can tell you the things I know he did do.

    1. Disabled our ads temporarily

    2. deleted the second view entirely and went with native orientation and resizing

    3. added this to almost every .m file.

      -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {    
      return YES;
      

      }

    4. As well a programmatically changed a few of the other views similar to this

      -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
      {
           if (interfaceOrientation == UIDeviceOrientationLandscapeLeft || interfaceOrientation == UIDeviceOrientationLandscapeRight)
           {
                if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) 
                {         
                     self.Button.frame = CGRectMake(27,96,86,86);
                     self.Label.frame  = CGRectMake(27,162,86,21);
                }
               else 
               {
                     self.Button.frame = CGRectMake(18,100,86,86);
                     self.Label.frame  = CGRectMake(18,164,86,21);
                }
           }
       } 
      

    Sorry, I can’t fully explain the answer, I do not fully understand everything that was included in the project that affected the orientation. I am still very new to iOS development.

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

Sidebar

Related Questions

I realize that there are many questions similar to this one, but having looked
I realise that there are many existing questions regarding this issue, but I haven't
I realize that there are many similar questions, but most involve scaling down the
I realize that there are many threads already posted that deal with this very
I realize that there are many questions explaining how to get two DIVs to
I realize there are similar questions on this topic, but I still cannot find
I'm really sorry, I realize there have been several questions asked about cocos2d touch
I know there have been many questions asking for help converting URLs to clickable
I realise that there are many older questions addressing the general question of NUnit
I realize there is a somewhat related thread on this here: Loading assemblies and

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.