开发者

pushing view controller inside a tab bar from app delegate, after a notification

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


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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜