【发布时间】:2014-11-07 06:33:01
【问题描述】:
我有一个通过 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;
}
【问题讨论】:
标签: ios rotation orientation ios8 uiactionsheet