Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ipad simulator rotating

Tags:

iphone

ipad

I am testing an application on iPad Simulator and I need it to start my app in the position the simulator is but every time I run the app, the simulator rotates to portrait.

Is there a way to stop this behavior?

thanks.

= = = =

last time edit: I discovered now that if I return NO on shouldAutorotateToInterfaceOrientation, the problem stops. But this is insane because shouldAutorotateToInterfaceOrientation should rotate the interface to match the iPad position, not the contrary.

like image 324
Duck Avatar asked May 05 '10 03:05

Duck


2 Answers

I had this problem when running the GHUnit test app in the simulator. I fixed it by adding this to the info.plist file:

<key>UISupportedInterfaceOrientations~ipad</key>
<array>
  <string>UIInterfaceOrientationPortrait</string>
  <string>UIInterfaceOrientationPortraitUpsideDown</string>
  <string>UIInterfaceOrientationLandscapeLeft</string>
  <string>UIInterfaceOrientationLandscapeRight</string>
</array>

If you edit this using Xcode's plist editor, make sure you have the "Show Raw Keys/Values" option turned on.

like image 135
Hugh Avatar answered Nov 02 '22 23:11

Hugh


The iPad supports multiple launch images (as opposed to the iPhones singular default.png) so that an application can be launched in all rotations. Specifics here

I'm guessing that you are missing the new ones (default-landscape.png etc) so that when the application loads it can only find the portrait loading screen and therefor triggers a rotation (and the simulator responds by rotating to portrait). When you have shouldAutorotateToInterfaceOrientation return NO, it still can't find a landscape image but doesn't allow the rotation to take affect?

like image 21
davbryn Avatar answered Nov 02 '22 22:11

davbryn