如何从 UITabBarController 启动的控制器链接模态视图
我将如何从 UITabBarController 的视图链接多个模式控制器? Apple 的视图编程指南说这是可行的,但是当我尝试这样的任务时,我收到错误,
"*Assertion failure in -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:], /SourceCache/UIKit_Sim/UIKit-1447.6.4/UIWindowController.m:186
类层次结构是这样的:
UITabBarController -> 1 个子级是一个名为 Tab1Controller 的 UIViewController 继承类。
Tab1控制器->编排需要以模态方式呈现的 2 个控制器中的每一个。 启动 1 个模态 UIViewController,当完成时(通过回调调用),将其关闭,然后启动另一个模态 UIViewController。
就好像两个模态控制器结束和开始之间没有足够的时间。
是否有任何示例代码显示如何链接一个又一个模态控制器?
How would I go about chaining several modal controllers from a UITabBarController's view? The View Programming Guide from Apple says this is feasible but when I attempt such a task, I get the error,
"*Assertion failure in -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:], /SourceCache/UIKit_Sim/UIKit-1447.6.4/UIWindowController.m:186
The Class hierarchy is something like this:
UITabBarController -> 1 child is a UIViewController inherited class named, Tab1Controller.
Tab1Controller -> orchestrates each of the 2 controllers that need to be presented modally.
Launches 1 modal UIViewController and when this finishes up (get called via a callback), dismisses it and then initiates another modal UIViewController.
It's as if there's not enough time between the two modal controllers ending and starting.
Is there any sample code that shows how to have one modal controller after another can be chained?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请参阅我对此问题的回答:
显示连续模态视图的正确方式
See my answer to this SO question:
Correct way of showing consecutive modalViews
我认为你说到点子上了。在前一个模态视图控制器完全消失并且在被旧模态视图覆盖的视图控制器上调用 viewDidAppear: 方法之前,您无法呈现新的模态视图控制器。
另一种选择是在第一个模态视图之上呈现第二个模态视图,例如,
您可以调用
[firstModalViewController DismissModalViewControllerAnimated:YES]
来关闭第二个模态视图(返回到第一个),或者[ selfmissModalViewControllerAnimated:YES]
一次关闭两者。I think you've hit the nail on the head there. You cannot present a new modal view controller until the previous one has finished disappearing and the
viewDidAppear:
method is called on the view controller that had been being covered by the old modal view.Another option would be to present the second modal view on top of the first, e.g.
You can then call
[firstModalViewController dismissModalViewControllerAnimated:YES]
to dismiss the second (returning to the first), or[self dismissModalViewControllerAnimated:YES]
to dismiss both at once.