应用程序试图以模态方式呈现活动控制器 [英] Application tried to present modally an active controller

查看:17
本文介绍了应用程序试图以模态方式呈现活动控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索并找到了有关此错误的各种 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' presentModalViewController:submenuView animated:YES]; 我收到错误应用程序试图以模态方式呈现活动控制器(我如果我将 uitableviewcontrollername 替换为 self,则会出现相同的错误.

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.

推荐答案

针对我的特定需求,以下是从tableview返回的技巧:

For my specific needs, the following did the trick for getting back from thetableview:

[self.mapLegendViewControllerdismissModalViewControllerAnimated:YES];

Gregory 的观点已被注意到,我建议阅读他制作的链接,因为有趣的是 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆