本文介绍了UIModalTransitionStylePartialCurl无法在iOS 8上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码在iOS7及以下版本中运行得非常好。
但是使用xcode6和iOS8时,UIModalTransitionStylePartialCurl无效。当视图出现时,页面卷曲在几分之一秒内消失。

I have the code that works absolutely fine with iOS7 and below versions.But with xcode6 and iOS8 UIModalTransitionStylePartialCurl is not working. page curl dismisses in fraction of second as view appears.

MyViewController* opts = [[MyViewController alloc] initWithView:someView];
opts.modalPresentationStyle = UIModalPresentationFullScreen;
opts.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentViewController:opts animated:YES completion:nil];

- 我发现如果构建完成xCode5.1并在iOS8上运行,则可以预期。 xCode6和iOS8构建有什么问题吗?

- I found that if build is done xCode5.1 and run on iOS8 this works as expected. Something wrong with xCode6 and iOS8 build?

推荐答案

从评论中的第一个链接复制(我在该帖子中的解决方案)。

Copied from the first link in the comment (my solution in that post).

我遇到了同样的问题,我应用了这个修复程序,它适用于iOS 8和Xcode 6。

I had the same issue and I applied this fix, it worked for me on iOS 8 and Xcode 6.

    [_mapToolbarController setModalTransitionStyle:UIModalTransitionStylePartialCurl];
    [self presentViewController:_mapToolbarController animated:YES completion:^{
        [_mapToolbarController.view.superview addSubview:self.view];
    }];

显然,_mapToolbarController将是您想要呈现的控制器。要了解为什么需要这个,请在​​完成处理程序的行中添加断点。做动画,你会在完成处理程序中看到卷曲动画刚刚完成,一切都很好。由于某种原因我无法解释,在iOS 8中你需要告诉iOS框架保持卷曲的视图,并确保它不被丢弃。完成处理程序中的代码尝试将即将褪色的卷曲视图保留到屏幕上。请注意,在此上下文中,self.view是正在卷曲的视图。

Obviously, _mapToolbarController will be the controller that you want to present. To see why you'd need this, add a breakpoint at the line in the completion handler. Do the animation, and you'll see in the completion handler that the curling animation had just finished and everything was perfectly fine. For some reason that I can't explain, in iOS 8 you'll need to tell the iOS framework to "keep" the curled view and make sure it doesn't get thrown away. The code in the completion handler tries to "keep" the soon-to-be-faded curled view onto the screen. Note that in this context, self.view is the view that is being curled.

这篇关于UIModalTransitionStylePartialCurl无法在iOS 8上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 15:09