我曾经使用呈现样式 UIModalPresentationCurrentContext 从另一个 UIViewController 呈现一个 UIViewController。但它不允许我旋转 presentingviewcontroller(呈现新 UIViewController 的 UIViewController)
self.modalPresentationStyle = UIModalPresentationCurrentContext;
NewViewController *newViewController = [[NewViewController alloc] initWithNibName:@"NewViewController" Bundle: nil];
[self presentViewController:newViewController animated:YES completion:nil];
当我旋转设备时,它会旋转 newViewController 和 statusbar 但不会旋转 presentingViewController
PS:这里的presentingViewController是self。
最佳答案
使用 UIModalPresentationFormSheet 而不是 UIModalPresentationCurrentContext
试试这个
self.modalPresentationStyle = UIModelPresentationFormSheet;
NewViewController *newViewController = [[NewViewController alloc] initWithNibName:@"NewViewController"Bundle: nil];
[self presentViewController:newViewController animated:YES completion:nil];
关于iphone - UIViewController - UIModalPresentationCurrentContext 不旋转 presentingViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19448494/