本文介绍了关闭模态视图控制器堆栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出以下视图控制器布局。





我们通过首先在 A 上呈现 B 然后呈现 C来构建一组模态视图控制器 B 。根据


Given the following view controller layout.

We build a stack of modal view controllers by first presenting B on A and then presenting C on B. According to the Apple documentation on dismiss(animated:completion:), calling it on A should actually dismiss the topmost view controller (C in this case) in an animated fashion and all intermediate view controllers without animation. What happens though is that C gets dismissed without animation and B is dismissed in an animated fashion.

I put up an Xcode project on GitHub that replicates that behaviour. Am I missing something or am I misunderstanding the documentation here?

解决方案

After poking around the web and trying out various 'solutions' it is clear this is an actual bug within iOS. It has been present since iOS 8... and is still present in iOS 10. It was originally reported in iOS 8, but the solution was never validated and Apple automatically closed the radar due to inactivity.

I have filed a new radar as this is in direct contradiction to the documentation for dismissViewController

Clear visualization of the issue, both expected and actual results. Credit to Boris Survorov for the test project and visualizations.

这篇关于关闭模态视图控制器堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-20 18:15
查看更多