views:

178

answers:

1

hi

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

A: 

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]
Jeff Kelley
thanks jeffnow its working, only had to change the last command to:[rootControler presentModalViewController:navigationController animated:YES];good day
shani
No problem. Feel free to click the green checkmark to mark this answer as accepted; it'll help your chances of getting future questions answered.
Jeff Kelley