My (Universal iPhone/iPad) app will not rotate. In all of my viewcontrollers I return "YES" to the method shouldRotate, but my viewcontrollers' willRotateToInterfaceOrien开发者_C百科tation methods never get called.
Is this a common issue?
In that universal app are you using a splitViewController? If so make sure all your viewControllers return Yes to should autoRotate.
I passed an array of viewControllers (actually NavigationViewControllers) to a splitViewController and my view did not rotate. This was because my left hand viewController was not implementing shouldAutorotate. I think this is because rotation on an iPad when you use a splitViewController is different then on an iPhone. When rotated it shows two viewControllers. Both have to support landscape mode i guess?
If you do not want the rotation of the one viewController to rotate do a conditional check to see if you are on an iPad in the shouldAutoRotate method.
Are you using a tab bar? You will need to subclass your tabbar controller and return yes for should rotate.
I just ran into this. The solution was to subclass UISplitViewController and add
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
Even though the individual view controllers were already returning YES, it didn't work until I added the split view controller subclass.
精彩评论