我曾经使用 UIModalPresentationCurrentContext
的模态展示方式,从另一个 UIViewController
中展示 UIViewController
。但这样会导致无法旋转呈现视图控制器(即呈现新的 UIViewController
的那个 UIViewController
)。
self.modalPresentationStyle = UIModalPresentationCurrentContext;
NewViewController *newViewController = [[NewViewController alloc] initWithNibName:@"NewViewController" Bundle: nil];
[self presentViewController:newViewController animated:YES completion:nil];
当我旋转设备时,它会旋转`newViewController`和`statusbar`但不会旋转`presentingViewController`(即`self`)。
PS: 这里的`presentingViewController`是`self`。
UIModalPresentationCurrentContext
。我将其更改为UIModelPresentationFormSheet
并更改其父视图大小,这解决了我的问题。 - Rafeek