How to make custom transition for iOS7 that are compatible with iOS8?

与世无争的帅哥 提交于 2019-12-14 02:39:57

问题


I want to create a custom transition for my view controllers. I have begun to gather some information about the new API introduced in iOS7. But I have been told that this API somehow changed in iOS8. The video 214 of WWDC 2014 tackles this point.

And some people told me that the custom transitions they created for iOS7 don't work properly on iOS8 (see for instance here and also there).

So my question:

Could you give some general advice, a guideline, for creating a custom transition that has to be iOS7 compatible and that will not break on iOS8? What should I specifically avoid? What does make the transitions failing to work on iOS8?


回答1:


Colas, I think that what you need has possibly already been discussed on Another Question.

I hope that this is what you need! If you follow the link in the comments below that question it will take you to [This Second Question]"From View Controller" disappears using UIViewControllerContextTransitioning) where they discuss it more in depth. For example:

"I played around a bit and it looks like there is an easy workaround, for simple cases. You can just re-add the toViewController's view as a subview of the key window's:

transitionContext.completeTransition(true) UIApplication.sharedApplication().keyWindow!.addSubview(toViewController.view) I've checked and the key window's rootViewController is still correctly set, so that's fine. I'm not sure what would happen if you presented your controller from within an already presented modal controller, so for more complex cases, you'll have to experiment around."

I hope that this can help solve your issue as well.



来源:https://stackoverflow.com/questions/29436076/how-to-make-custom-transition-for-ios7-that-are-compatible-with-ios8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!