我如何获得当前的活动视图控制器? [英] How do i get current active view controller?

查看:78
本文介绍了我如何获得当前的活动视图控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这个问题(某些用户的Flurry分析报告错误,但我无法在我的设备或模拟器上重现它):

I'm having this issue (error is reported by Flurry analytics from some users, but I cannot reproduce it neither on my device nor simulator):

NSInvalidArgumentException:应用程序尝试以模态方式呈现活动控制器< CityViewController:0x361b20>。

您对此错误有所了解吗? ?它发生在你身上吗?

Do you know anything about this error? Has it happened to you?

应用程序有三个分层排序的视图:主视图控制器带有位置列表和详细视图(错误消息中提到的CityViewController)会自动显示用户位于已知位置之一。每当位置发生重大变化时,在打开新位置之前,首先会忽略详细视图以防止这种情况发生。但是,它显然没有帮助。

Application has three hierachically sorted views: master view controller with list of locations and detail view (the CityViewController mentioned in error message) is automatically presented when user is at one of known locations. Whenever location significantly changes, detail view is dismissed first before opening new location to prevent this. However, it apparently doesn't help.

CityViewController也可以打开短信作曲家作为孩子。

CityViewController can also open SMS composer as its child.

推荐答案

要获得当前可见的视图,您可以使用:

To get the currently visible view you can use:

[self.navigationController visibleViewController];

这篇关于我如何获得当前的活动视图控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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