Jane describes setting UIInterfaceOrientation to UIInterfaceOrientationLandscapeRight (or UIInterfaceOrientationLandscapeLeft) and the rotation parameters recommended in the documentation, but I used a slightly different code block (at the same end) in my root view controller:
- (void)loadView { UIView *primaryView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; primaryView.backgroundColor = [UIColor clearColor];
In addition to this, I applied the following delegate method in the root view controller:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return ( (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight)); }
Finally, I came across strange glitches when the simulator did not work automatically, so I needed to implement the following delegate method in my UIApplicationDelegate:
- (void)application:(UIApplication *)application willChangeStatusBarOrientation:(UIInterfaceOrientation)newStatusBarOrientation duration:(NSTimeInterval)duration; {
After that, my application was able to start from the landscape (on the right) and remain in this orientation under firmware 2.0 and in Simulator.
Brad Larson Feb 08 '09 at 20:02 2009-02-08 20:02
source share