Question

i have an app with tab bar and a navigation controller inside every tab. i have set a notification that when it lunches the user can get lunch the app by pressing the action on the alert.

i want to redirect the user to one of the views inside one of the controllers.

i have tried this:

- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif {
    NSArray *data = [notif.userInfo objectForKey:@"todoDate"];
    NSInteger ind = [[data objectAtIndex:2] integerValue];

    QuickViewController *detailViewController ;
    detailViewController = [[QuickViewController alloc] initWithNibName:@"QuickViewController" bundle:nil];

    detailViewController.title = @"Edit";
    detailViewController.personName = [data objectAtIndex:0];
    detailViewController.DelitionDate=[data objectAtIndex:1];
    detailViewController.personCategory=@"NO Category";
    detailViewController.personID = ind r ;

    rootControler.selectedIndex = 1;
    [rootControler.tabBarController.selectedViewController.navigationController pushViewController:detailViewController animated:YES];
}

but nothing is happening (no crashing) except of the :rootControler.selectedIndex = 1;

when i tried : presentModalViewController

i got the view perfectly but without the navigation controller.

thanks shani

Was it helpful?

Solution

It sounds like you're pushing detailViewController when you really want to push a UINavigationController with detailViewController as its root view. Try something like this:

QuickViewController *detailViewController ;

detailViewController =
[[QuickViewController alloc] initWithNibName:@"QuickViewController"
                                      bundle:nil];

UINavigationController *navigationController =
[[UINavigationController alloc] initWithRootViewController:detailViewController];

[detailViewController release];

...

[rootControler.tabBarController.selectedViewController.navigationController 
pushViewController:navigationController animated:YES]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top