Objective c 如何知道哪个uiview用户正在使用

Objective c 如何知道哪个uiview用户正在使用,objective-c,push-notification,uialertview,uiapplicationdelegate,Objective C,Push Notification,Uialertview,Uiapplicationdelegate,我正在实现推送通知,并在用户使用应用程序时对其进行管理。因此,会出现一个警报视图,单击该视图时,它必须重定向到uiview。现在,如果用户在发出警报时显示uiview,我如何知道顶部的uiview?如何更新当前的uiview?警报显示在metod DidReceiveMotonification中的应用程序委托中。 谢谢 编辑: 我想这样做: UiviewController current* = [delegate getCurrentView]; if(current.toString=="

我正在实现推送通知,并在用户使用应用程序时对其进行管理。因此,会出现一个警报视图,单击该视图时,它必须重定向到uiview。现在,如果用户在发出警报时显示uiview,我如何知道顶部的uiview?如何更新当前的uiview?警报显示在metod DidReceiveMotonification中的应用程序委托中。 谢谢

编辑: 我想这样做:

UiviewController current* = [delegate getCurrentView];
if(current.toString=="NotificationView"){
   [current update:notificationText];
}else{
   saveNotification;
   goToNotificationView;
}

我认为很可能您的主
窗口中有
UINavigationController
(它可以是
uitabarcontroller
,等等),但是如果您的主
窗口中有
UINavigationController
,那么您可以使用
[self.navigationController topViewController];
或者您也可以检查
UINavigationController
viewControllers
堆栈,该堆栈返回您推入的所有视图控制器的数组
UINavigationController
,并可以使用
[[self.navigationController viewControllers]lastObject];


如果在主
窗口中有
UITabBarController
,则可以使用
[[self.tabbarcontroller viewControllers]objectAtIndex:[self.tabbarcontroller selectedIndex]]获取
UINavigationController
(如果有)的实例;
并可以执行上述步骤以获取俯视图。

视图控制器有一个
视图
属性,它是它的根视图。这是您要查找的吗?