草庐IT

iphone - UIViewController - UIModalPresentationCurrentContext 不旋转 presentingViewController

coder 2023-09-21 原文

我曾经使用呈现样式 UIModalPresentationCurrentContext 从另一个 UIViewController 呈现一个 UIViewController。但它不允许我旋转 presentingviewcontroller(呈现新 UIViewControllerUIViewController)

self.modalPresentationStyle = UIModalPresentationCurrentContext;
NewViewController *newViewController = [[NewViewController alloc] initWithNibName:@"NewViewController" Bundle: nil];
[self presentViewController:newViewController animated:YES completion:nil];

当我旋转设备时,它会旋转 newViewControllerstatusbar 但不会旋转 presentingViewController

PS:这里的presentingViewControllerself

最佳答案

使用 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/

有关iphone - UIViewController - UIModalPresentationCurrentContext 不旋转 presentingViewController的更多相关文章

随机推荐