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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:44:46+00:00 2026-05-26T07:44:46+00:00

An engine that I’ve worked on for a while and has shipped games is

  • 0

An engine that I’ve worked on for a while and has shipped games is now launching my current project upside down and right away rotates the UIView the way it suppose to be. I create the interface with code and this is about how it looks like:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{    
    ...

    CGRect screenBounds = [[UIScreen mainScreen] applicationFrame]; 
    CGRect windowBounds = screenBounds; 
    windowBounds.origin.y = 0.0;
    UIWindow* win = [[UIWindow alloc] initWithFrame:windowBounds];  
    win.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    UIMyView* view = [[UIMyView alloc] initWithFrame:screenBounds]; 
    UIMyViewController* controller = [[UIMyViewController alloc] init]; 
    controller.view = view; 

    view.multipleTouchEnabled = true;   
    view.windowWrapper = this;  
    view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    [win addSubview:view];

    ...
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation;
{
    s32 validOrientations = ((cViewMM*)(self.view)).windowWrapper->GetValidOrientations();
    if (toInterfaceOrientation == UIInterfaceOrientationPortrait && (validOrientations & 0x01))
        return true;

    if (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown && (validOrientations & 0x02))
        return true;

    if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft && (validOrientations & 0x04))
        return true;

    if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight && (validOrientations & 0x08))
        return true;

    return false;
}

The problem occures only if I want to launch the application in UIInterfaceOrientationLandscapeLeft. Debugging through the application it looks like when I try to add my view to the window internally the shouldAutorotateToInterfaceOrientation: is called multiple times. First with UIInterfaceOrientationPortrait which returns false then UIInterfaceOrientationLandscapeRight which return true (since it’s valid orientation) and then UIInterfaceOrientationLandscapeLeft which also returns true (since it’s valid orientation and it’s the current orientation of the device).

Oh and to be more specific this is happening only on iPhone not on iPad. They use the same code to setup this view.

What am I doing wrong?

— EDIT —

OK I was wrong about the execution of shouldAutorotateToInterfaceOrientation: it is executed 3 times asking for UIInterfaceOrientationPortrait, 2 times for UIInterfaceOrientationLandscapeLeft, then once for UIInterfaceOrientationLandscapeRight, and again once UIInterfaceOrientationLandscapeLeft.

GameCenter is alreay initializing at this point and since it’s pushing some extra UI I thought it may be it, but it wasn’t.

  • 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-26T07:44:47+00:00Added an answer on May 26, 2026 at 7:44 am

    Check in your Info.plist that the array of supported orientations starts with portrait (right-side-up). If it starts with any different orientation your app will launch in that orientation.

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

Sidebar

Related Questions

If have I have a game engine that has multiple threads that all work
I have an engine that has quite a few dependencies. To make it easier
I have a static library Xcode 4 project that includes a home-brewed rendering engine,
I developed a scripting engine that has many built-in functions, so to call any
I have built a dom object Engine that has private/public fields/methods that I have
I am writing an e-commerce engine that has a reputation component. I'd like users
I am looking for a Html rendering engine that has: Support in a good
We have an engine that loads dlls dynamically (whatever is located in a certain
I have a game engine that uses OpenGL for display. I coded a small
I have a search engine that searches albums. For each music album, 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.