应用程序尝试以模态方式呈现活动控制器 [英] Application tried to present modally an active controller
问题描述
我已经搜索过并找到了关于此错误的各种q / a,但未能找到我的问题的任何具体帮助(至少我的最小经验让我理解)。
I have searched for and found various q/a on this error, but have not been able to find any specific help for my issue (at least that my minimal experience allows me to understand).
我正在从应用程序的主菜单加载UIView,而主菜单又有几个按钮选项(称之为子菜单)。其中一个回到主菜单没有问题( [self dismissModalViewControllerAnimated:YES];
)。另一个按钮加载一个UITableView(单独的视图控制器),加载很好。但是,我希望在这个UITableView中有一个按钮返回子菜单。当我使用上面提到的代码时,它会一直回到主菜单。我似乎无法找到一种方法来创建一个可以追溯到子菜单UIView(子菜单)的动作。
I am loading a UIView from the app's main menu, which in turn has several button options (call it submenu). One of these goes back to the main menu without issue ([self dismissModalViewControllerAnimated:YES];
). Another button loads a UITableView (separate view controller), which loads fine. However, I want a button within this UITableView to go back to the submenu. When I use the above mentioned code, it goes all of the way back to the main menu. I can't seem to find a way to create an action that goes back to the submenu UIView (submenu).
当我尝试做一个标准的 ['uitableviewcontrollername'lastModalViewController:submenuView animated:YES];
我收到错误应用程序试图以模态方式呈现一个活动控制器(如果我替换uitableviewcontrollername,我会得到同样的错误自我。
When I try to do a standard ['uitableviewcontrollername' presentModalViewController:submenuView animated:YES];
I get the error Application tried to present modally an active controller (I get the same error if I replace uitableviewcontrollername with self.
错误是有道理的,因为我明白它已经是活跃的,但我需要帮助的是,究竟什么是正确的方法来做我的事情上面已经描述过了?感谢你的时间。
The error makes sense in that I understand that it is already active, but what I need help with is, what exactly is the proper way to do what I've described above? Thanks for your time.
推荐答案
为了满足我的特殊需求,以下是从thetableview回来的诀窍:
For my specific needs, the following did the trick for getting back from thetableview:
[self.mapLegendViewController dismissModalViewControllerAnimated:YES];
格雷戈里的观点虽然引人注目,但我建议阅读他所做的链接,因为iPhone / iPad的每个手柄都很有趣这些行动。
Gregory's point is noted though, and I recommend reading the link he made as it is interesting as to how iPhone/iPad each handle these actions.
这篇关于应用程序尝试以模态方式呈现活动控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!