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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:31:45+00:00 2026-05-18T00:31:45+00:00

I am trying to create a game on the iPhone, however I am running

  • 0

I am trying to create a game on the iPhone, however I am running in to some (I hope) simple, yet confusing issues.

I am forcing my application to be in UIInterfaceOrientationLandscapeRight mode, this is set in the .plist and each of my UIViewControllers returns this as the only viable orientation for shouldAutorotateToInterfaceOrientation

That works… sometimes. Each of my xibs have been designed to be in landscape mode, and all ViewControllers are set up in a very similar fashion. Here is my problem:

I instantiate all of my UIViewControllers programatically such as:

splashScreen = [[SplashScreenController alloc] initWithNibName:@"SplashScreenView" bundle:[NSBundle mainBundle]];
splashScreen.view.frame = CGRectMake(0, 0, [[GameConsts defaultGameConsts] screenWidth], [[GameConsts defaultGameConsts] screenHeight]);
[[self view] addSubview: [splashScreen view]];

mainMenu = [[MainMenuController alloc] initWithNibName:@”MainMenuView” bundle:[NSBundle mainBundle]];
mainMenu.view.frame = CGRectMake(0, 0, [[GameConsts defaultGameConsts] screenWidth], [[GameConsts defaultGameConsts] screenHeight]);
[[self view] addSubview: [mainMenu view]];

This works fine, but when I activate my “game views”, i.e., the in-game menus and actual playing field I need to invert the screenWidth and screenHeight parameters to get them to be correctly displayed. I do not understand why this is, and I have not yet been able to figure it out. Here is how they are being instantiated:

- (void) setupGameViews
{
 // Why do these need to be reversed to show up properly? (Height and Width!)
 gameView = [[GameController alloc] initWithNibName:@"GameView" bundle:[NSBundle mainBundle]];
 gameView.view.frame = CGRectMake(0, 0, [[GameConsts defaultGameConsts] screenHeight], [[GameConsts defaultGameConsts] screenWidth]);
 [[self view] addSubview: [gameView view]];

 gameMenu = [[GameMenuController alloc] initWithNibName:@"GameMenuView" bundle:[NSBundle mainBundle]];
 gameMenu.view.frame = CGRectMake(0, 0, [[GameConsts defaultGameConsts] screenHeight], [[GameConsts defaultGameConsts] screenWidth]);
 [[self view] addSubview: [gameMenu view]];
}

(Note: This method is being called when a start game button is clicked. This is all inside a “parent” UIViewController that has no associated view with it, but instead contains and sets up all of these subviews. Maybe there is an issue with their architecture? I have seen some similar examples around, so I decided to use it.)

For completeness, here are the definitions in the GameConsts singleton during its init method:

- (id) init
{
 screenWidth = [[UIScreen mainScreen] applicationFrame].size.width;
 screenHeight = [[UIScreen mainScreen] applicationFrame].size.height;

 screenCenter = CGPointMake(screenSizeHeight / 2, screenSizeWidth / 2);

 return [super init];
}

screenWidth and screenHeight are floats. screenCenter is a CGPoint. If you note, I have reversed the height/width in the screenCenter CGPoint because otherwise when I try to draw an object at the screen center it shows up in the bottom left corner of the screen.

This is driving me crazy and keeping me from the far more fun parts of this experience. If anyone can provide help, it would be wonderful. If any more information is needed, let me know.

  • 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-18T00:31:46+00:00Added an answer on May 18, 2026 at 12:31 am

    I think that applicationFrame always returns a frame for portrait orientation.

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

Sidebar

Related Questions

I have an iPhone game that I'm trying to create for school, yet I'm
I am trying to create a game for iPhone, iPad and Android in unity3d.
I'm new in games development, am trying to create a simple game in flash-cs5.
I am trying to create a simple drawing game like DrawSomething. The problem here
I'm trying to create a simple game loop and trying to use OOP paradigm
I'm trying to create a simple Game of Life by storing Cell objects into
I am trying to create a simple game. What it should do: Create 2
I am creating an iPhone application, a game, and I am trying to understand
I am trying to learn OpenGL ES 2.0 to do some iPhone game development.
While trying to create a simple game where a square is manipulated via the

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.