1

splitviewController在我的应用程序中使用了一个。应用程序的方向严格设置为横向。我已经在构建设置中正确完成了。

当我在 iOS 5.1 或更高版本中运行我的应用程序时,它运行良好。但是当我在 iOS 5 或更低版本中运行我的应用程序时,应用程序的方向不会更改为横向。这是个大问题。有什么解决办法吗?

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  // Return YES for supported orientations
  return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
4

3 回答 3

1

viewControllers全部使用这个orientation

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
   // Return YES for supported orientations
   [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
   return UIInterfaceOrientationIsLandscape(interfaceOrientation);
 }
于 2012-12-28T06:37:33.550 回答
0

简单的。改为插入以下内容:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
于 2012-12-28T05:13:57.363 回答
0

你应该更换你的

return (interfaceOrientation == UIInterfaceOrientationPortrait); 

声明与

return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
于 2012-12-28T05:27:51.860 回答