Kieran's Mobile + Tech Observations
  • Email
  • Flickr
  • Twitter
  • Rss
Search
Home» Mobile » iPhone » Making the iPhone simulator behave in landscape for the 1st view

Making the iPhone simulator behave in landscape for the 1st view

Posted by Kieran - November 5, 2009 - iPhone, Mobile
0

Discovered some fairly interesting behaviour of the iPhone simulator that had me stumped for a little while

When you want to have an application that starts up in Landscape without a status bar
the following code snippit placed into your applicationDidFinishLaunching method of the app delegate will allow you to test in the emulator!

//For your normal application execution on the iPhone, this can also be done in the info.plist
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];

//How to make the simulator behave itself preprocess for just the simulator
#if (TARGET_IPHONE_SIMULATOR)
UIScreen *screen = [UIScreen mainScreen];
tabBarController.view.bounds = CGRectMake(0, 0, screen.bounds.size.height, screen.bounds.size.width);
tabBarController.view.transform = CGAffineTransformConcat(tabBarController.view.transform, CGAffineTransformMakeRotation((M_PI * 90 / 180.0)));
tabBarController.view.center = window.center;
#endif

tabBarController in this case is the first view controller given to the window

Hope this helps someone else!

iPhone

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Blogroll

  • Sci-Fi-O-Rama

Latest Tweets

  • @secboffin @darkrock @bookmeister I bet if we look hard enough that acronym has gone already in telco land
    May 18, 2012 - 6:16 pm
  • @bookmeister @secboffin @darkrock nah apps launching more rare than mm7 working
    May 18, 2012 - 6:15 pm
  • .@LondonMidland Train home silly rammed as usual, hurry up HS2 or better transport in the UK. Alternatively teleporters
    May 18, 2012 - 6:15 pm
(c) 2012 Kieran's Mobile + Tech Observations - Web Design by Jason Bobich