Reputation: 685
My first view controller is LoginViewController. I'm trying to support autorotate management on iOS 6.
I've implemented shouldAutorotate instead of shouldAutorotateToInterfaceOrientation, like this:
-(BOOL)shouldAutorotate {
UIInterfaceOrientation toInterfaceOrientation = [[UIDevice currentDevice] orientation];
return [DeviceSupport isOrientationSupported:toInterfaceOrientation];
}
shouldAutorotate
is called five times at the launch of application. toInterfaceOrientation values are, in order and without changing ipad orientation : 0, 0, 0, 4 and 4. First, why app take so long time to put the right orientation in the currentDevice? And why shouldAutorotate is called five times?
When orientation is 4, [DeviceSupport isOrientationSupported:toInterfaceOrientation]
return true. But my app does not rotate.
In my info.plist :
Supported interface orientations
=> Item 0: Portrait (bottom home button)
=> Item 1: Portrait (top home button)
Supported interface orientations (iPad)
=> Item 0: Landscape (left home button)
=> Item 1: Landscape (right home button)
Any idea? thanks.
Upvotes: 0
Views: 1713
Reputation: 147
Could you double-check that you implemented supportedInterfaceOrientations as well?
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
Upvotes: 0
Reputation: 3136
Change you code from:
[self.window addSubview:aController.view];
to this code:
self.window.rootViewController = aController;
Also add the following methods for orientation support
shouldAutorotate -return YES
supportedInterfaceOrientations- return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft;
Upvotes: 3