【发布时间】:2013-01-19 09:50:07
【问题描述】:
我有父视图控制器和另一个模态视图控制器。 我在父级上下文中展示了模态视图控制器:
readingViewController * reading_view_controller = [[readingViewController alloc] initWithNibName:@"readingViewController" bundle:nil];
[self setModalPresentationStyle:UIModalPresentationCurrentContext];
[self presentModalViewController:reading_view_controller animated:YES];
父视图控制器不会定位横向;所以,我在父 viewController 中添加了这些方法:
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortraitUpsideDown|UIInterfaceOrientationMaskPortrait;
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
return (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}
呈现的视图控制器(模态呈现)应该面向所有可能的方向;所以,我添加了这些方法:
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
return YES;
}
但是,因为我假设 (UIModalPresentationCurrentContext),呈现的 viewController 在 IOS 6.0 中没有定向,而它在 IOS 5.0 中按预期工作
请问这个问题怎么解决?
【问题讨论】:
标签: ios uiviewcontroller presentmodalviewcontroller device-orientation