开发者

Presenting two modal viewcontrollers in a row causes the second one to not appear

The problem is as follows: in my applicationDidEnterBackground I modally present a viewcontroller, say viewcontroller A. So every time the app is launched A is onscreen. Now if during the execution of the app some other viewcontroller, say viewcontroller B, is presented modally and the app is sent to the background, and then you relaunch the app, A is not visible. And that is the problem.

I tried all kinds of different things, including presenting A and B from different viewcontrollers, presenting A from B if B is onscreen, presenting A after a delay, subclassing B and making it present A when the app becomes active... Nothing seems to wo开发者_JAVA百科rk. I'm completely lost and I'm wondering if that is a bug. Any ideas?


Try to rework your app so that you are not presenting 2 modal views. You can't have 2 modals presented so you need to take your pick.

Usually you can animate the transition effect of a view controller to mimic what you were using the presentModal for.


Check out the MDFPResenter class I wrote. You use it to present instead of the UIViewController methods. It calls the UIViewController methods, but it ensures the calls are queued up properly so your app does not crash.

https://github.com/mpdifran/MDFPresenter

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜