小编Zac*_*hel的帖子

UIModalPresentationCurrentContext - 未调用旋转方法

我正在尝试使用UIModalPresentationCurrentContext在VC之上呈现VC,以便查看其背后的视图.以下代码有效:

UIViewController *transparentViewController = [[UIViewController alloc] init];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:transparentViewController animated:NO completion:^{
}];
Run Code Online (Sandbox Code Playgroud)

但是,当我按下VC后旋转设备时,旋转看起来完全搞砸了.它不是干净地旋转,而是笨拙地拉伸视图以适应新的方向.

此外,当我继承透明ViewController时,我发现它的viewwillautorotate方法没有被调用!(即使它以混乱的动画方式旋转)

UIModalPresentationCurrentContext样式是不是要旋转?有没有办法解决?还有其他人遇到过这个问题吗?

rotation transparent uiviewcontroller uimodalpresentationstyle

6
推荐指数
1
解决办法
931
查看次数