如何知道哪个uiview用户正在使用
我正在实现推送通知,并在用户使用应用程序时对其进行管理。因此,会出现一个警报视图,并且在视图上单击它必须重定向到 uiview。现在,如果用户在警报到来时显示 uiview,我怎样才能知道顶部的 uiview?我怎样才能更新当前的uiview?警报显示在应用程序委托的方法 didReceiveRemoteNotification 中。 谢谢
编辑: 我想做这样的事情:
UiviewController current* = [delegate getCurrentView];
if(current.toString=="NotificationView"){
[current update:notificationText];
}else{
saveNotification;
goToNotificationView;
}
I'm implementing push notification and i'm managing it when user is using app. So an alert view appear and on view click it must redirect to an uiview. now if user is showing that uiview when alert is coming how can i know the uiview on top? how can i update the uiview current? Alert is shown in application delegate in the metod didReceiveRemoteNotification.
Thankss
EDIT:
i want to do something like this:
UiviewController current* = [delegate getCurrentView];
if(current.toString=="NotificationView"){
[current update:notificationText];
}else{
saveNotification;
goToNotificationView;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您的主
窗口
中很可能有一个UINavigationController
(它可以是UITabBarController
等),但是如果您有一个>UINavigationController
在您的主窗口
中,然后您可以使用[self.navigationController topViewController];UINavigationController
的顶部视图控制器> 或者你可以还检查UINavigationController
的viewControllers
堆栈,该堆栈返回您在UINavigationController
中推送的所有视图控制器的数组,并且可以获取该UINavigationController
的最后一个对象code>array 这是使用[[self.navigationController viewControllers] lastObject]; 的顶视图。
如果您的主
window
中有一个UITabBarController
,那么您可以使用[ 获取
并且可以执行上述步骤来获取顶视图。UINavigationController
的实例(如果存在) [self.tabbarcontroller viewControllers] objectAtIndex:[self.tabbarcontroller selectedIndex]];I think most probably you have a
UINavigationController
in your mainwindow
(it can be aUITabBarController
,etc), but if you have aUINavigationController
in your mainwindow
then you can check the top view controller of yourUINavigationController
by using[self.navigationController topViewController];
or you can also check forUINavigationController
'sviewControllers
stack that returns an array of all view controller's you pushed inUINavigationController
and can get the last object of thatarray
which is your top view by using[[self.navigationController viewControllers] lastObject];
.If you have a
UITabBarController
in your mainwindow
, then you can get the instance ofUINavigationController
(if its there) by using[[self.tabbarcontroller viewControllers] objectAtIndex:[self.tabbarcontroller selectedIndex]];
and can do the above steps to get the top view.