如何检查我当前的navigationController.view是否=aclasses.view?原因=推送通知。 + iPhone
所以基本上在我的应用程序委托中我有一个 navigation.controller
这个导航控制器有一个名为 MainScreen 的类的视图。
在 MainScreen.m 中,我有一个 IBAction,通过推动它会将我带到 SelectionScreen.m 页面。这是它的编码
SelectionScreen *aSelectionScreenViewController = [[SelectionScreen alloc]initWithNibName:@"SelectionScreen" bundle:nil];
[self.navigationController pushViewController:aSelectionScreenViewController animated:YES];
[aSelectionScreenViewController release];
那么我如何检查我当前的navigationController.view =这个selectionscreen.view?
检查它是哪个当前视图的原因是因为当我收到推送通知时,我想自动切换到此 SelectionScreen.m 页面并调用其中的一些方法。但此检查只能在 appDelegate 中完成,因为 didReceiveRemoteNotification 方法位于其中。
so basically in my app delegate i have a navigation.controller
This navigation controller has a view of a class named MainScreen.
In MainScreen.m , i have a IBAction which will bring me to a SelectionScreen.m page by pushing it. here is the coding for it
SelectionScreen *aSelectionScreenViewController = [[SelectionScreen alloc]initWithNibName:@"SelectionScreen" bundle:nil];
[self.navigationController pushViewController:aSelectionScreenViewController animated:YES];
[aSelectionScreenViewController release];
So how do i check if my current navigationController.view = this selectionscreen.view?
The reason for checking which current view it is, is because when i receieve a push notification, i would want to automatically switch to this SelectionScreen.m page and invoke some methods within it. But this checking can only be done in the appDelegate because the didReceiveRemoteNotification method is located in there.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这就是我的做法,
例如,如果您有三个 ViewController,并且其中任何一个都有可能由 NavigationController 推送:
那么您需要做的是:
This is how i'm doing it
for example if you have three ViewControllers ,and any of those have possibility to be pushed by NavigationController:
Then what you need to do is:
一种方法是将 SelectionScreenViewController 保存为应用程序委托的属性,然后:
One way is to save selectionScreenViewController as a property of your app delegate, then:
嘿伙计们,我用一种简单的方式做到了。在我拥有的每个视图控制器中,我删除了所有对象并将一个对象分配给应用程序委托中的数组。这样,每次我进入一个新视图时,值都是不同的。
因此,在 appdidrecieveremotenotification 中,我可以检查该数组并决定相应的操作。
这只是一种简单的检查方法。
Hey guys, i did it in a simple way. In every view controller i had, i removed all objects and assigned an object to an array in the appdelegate. So this way, everytime i go to a new view, the value is different.
So in appdidrecieveremotenotification, i can check that array and decide on what to do accordingly.
Its just a simple way of checking.