如何限制UIPopoverController仅限纵向方向?

时间:2012-03-26 06:40:24

标签: iphone ios ipad

我正在开发一款使用相机功能的iPad应用程序。我正在将相机打开到UIPopoverController中。我的应用程序仅支持纵向方向,我想限制UIPopoverController也只支持纵向方向。

任何帮助都会很明显。

先谢谢。

2 个答案:

答案 0 :(得分:0)

要限制以纵向模式查看您的应用,请将其设置为....

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return NO;
}

在所有班级中设置return NO ......:)

答案 1 :(得分:0)

创建UIPopoverController的对象实例。方向改变时隐藏和取消隐藏。

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
   if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight))
   {
         // hidden your popover
   }
   return YES;
}