我在每个选项卡中都有一个带有标签栏的应用程序和一个导航控制器。我已经设置了一个通知,即当午餐时,用户可以通过在警报上按操作来获得午餐。

我想将用户重定向到其中一个控制器内部的视图之一。

我已经尝试了:

- (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];
}

但是除了:rootcontroler.selectedIndex = 1;

当我尝试时:PresentModalViewController

我得到了完美的视图,但是没有导航控制器。

谢谢Shani

有帮助吗?

解决方案

听起来你在推 detailViewController 当您真的想推一个 UINavigationControllerdetailViewController 作为其根视图。尝试这样的事情:

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]
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top