我有父视图控制器和另一个模态视图控制器。我在父级上下文中展示了模态视图控制器:
readingViewController * reading_view_controller = [[readingViewController alloc] initWithNibName:@"readingViewController" bundle:nil];
[self setModalPresentationStyle:UIModalPresentationCurrentContext];
[self presentModalViewController:reading_view_controller animated:YES];
父视图控制器不会定向横向;所以,我在父视图控制器中添加了这些方法:
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortraitUpsideDown|UIInterfaceOrientationMaskPortrait;
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
return (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}
呈现的 viewController(模态呈现)应该面向所有可能的方向;所以,我添加了这些方法:
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
return YES;
}
但是,因为我假设(UIModalPresentationCurrentContext),呈现的 viewController 在 IOS 6.0 中没有定向,而它在 IOS 5.0 中按预期工作
请问如何解决这个问题?