0

我已通过此代码阻止了界面方向。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;

    if (orientation == UIDeviceOrientationPortrait) {
        NSLog(@"portrait");
    }else{
        NSLog(@"landsape");
     }
        return NO;
     }

我正在使用弹出框指向向上的按钮。

[popoverController presentPopoverFromRect:[button bounds] inView:button allowedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

肖像模式是正确的。我的问题是如何相对于屏幕的纵向模式始终向上显示弹出框?如果有人有任何想法,请帮助...在此先感谢。

4

1 回答 1

0

如果您总是想使用纵向模式而不是用以下方法替换您的方法

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
   return (interfaceOrientation == UIInterfaceOrientationPortrait);
   }
于 2012-06-27T11:10:24.297 回答