我有一个应用程序,通过plist文件进行配置以支持纵向、左横向和右横向方向(即UISupportedInterfaceOrientations设置为UIInterfaceOrientationPortrait、UIInterfaceOrientationLandscapeLeft和UIInterfaceOrientationLandscapeRight)。但是在视图控制器中,我将支持的方向限制为仅支持纵向。如果我在视图控制器的视图上呈现UIActionSheet,然后旋转设备,UIActionSheet会旋转到新的方向。这只会发生在运行iOS 8(GM Seed)的设备上。
我希望UIActionSheet遵循包含视图控制器的规则而不旋转。您有什么想法吗?
UIViewController示例代码:
- (IBAction)onTouch:(id)sender
{
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:@"hi"
delegate:nil
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Open", nil];
[actionSheet showInView:self.view];
}
#pragma mark - Rotation methods
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}