views:

49

answers:

2

Hi guys, 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.

A: 

One way is to save selectionScreenViewController as a property of your app delegate, then:

if (self.navigationController.topViewController == self.selectionScreenViewController) {
   //...
}
else {
   //...
}
cduhn
Sorry i dun know how to do that :\ .
Kenneth
A: 

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.

Kenneth