标签栏 +导航栏

发布于 2024-08-02 20:49:44 字数 1249 浏览 2 评论 0原文

我有一个两个选项卡栏,在第一个选项卡中,我可以向下钻取三个以上...但在第二个选项卡中我不能向下钻取多个...有什么想法吗?

代码: DemoAppdelegate.m

- (void)applicationDidFinishLaunching:(UIApplication *)application {
[window addSubview:tabBarController.view];
}

First tab controller is "FirstViewController"
in FirstViewController.m i have written to drill down to "billsummary.xib" 


DemoAppDelegate *app = (DemoAppDelegate *)[[UIApplication sharedApplication] delegate];
    UINavigationController *naviController = app.navigationController;
    BillsSummary *aViewAController = [[BillsSummary alloc] initWithNibName:@"BillsSummary" bundle:[NSBundle mainBundle]];

    [naviController pushViewController:aViewAController animated:YES];
    [aViewAController release];

which is working fine.But same code for in second tab for another .xib is not working and in second tab i have not used appdelegate instead i used "self.navigationcontroller"

UINavigationController *naviController = self.navigationController;
    PaymentsAmount *aViewAController = [[PaymentsAmount alloc] initWithNibName:@"PaymentsAmount" bundle:[NSBundle mainBundle]];

    [naviController pushViewController:aViewAController animated:YES];  
    [aViewAController release];

该怎么办?有什么帮助吗?

I have a two tab bar,In first tab ,i can drill down more than three... but in second tab i cannot drill down more than one.. Any ideas?

code:
DemoAppdelegate.m

- (void)applicationDidFinishLaunching:(UIApplication *)application {
[window addSubview:tabBarController.view];
}

First tab controller is "FirstViewController"
in FirstViewController.m i have written to drill down to "billsummary.xib" 


DemoAppDelegate *app = (DemoAppDelegate *)[[UIApplication sharedApplication] delegate];
    UINavigationController *naviController = app.navigationController;
    BillsSummary *aViewAController = [[BillsSummary alloc] initWithNibName:@"BillsSummary" bundle:[NSBundle mainBundle]];

    [naviController pushViewController:aViewAController animated:YES];
    [aViewAController release];

which is working fine.But same code for in second tab for another .xib is not working and in second tab i have not used appdelegate instead i used "self.navigationcontroller"

UINavigationController *naviController = self.navigationController;
    PaymentsAmount *aViewAController = [[PaymentsAmount alloc] initWithNibName:@"PaymentsAmount" bundle:[NSBundle mainBundle]];

    [naviController pushViewController:aViewAController animated:YES];  
    [aViewAController release];

what to do? Any help please?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

孤星 2024-08-09 20:49:44

我不明白你的代码结构,但通常这个问题是通过以下方式解决的:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   ...

   // Initialize UINavigationControllers and push first viewcontrollers for each one

   UIViewController *view1 = [[UIViewController alloc] init];
   UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:view1];
   [view1 release];

   // Same for the second NavigationController 

   ...      

   // Initialize UITabBarController
   UITabBarController tController = [[UITabBarController alloc] init];
   tController.viewControllers = [NSArray arrayWithObjects:nav1, nav2, nil];
   [nav1 release];
   [nav2 release];

   [window addSubview:tController.view];

   ...
}

I didn't understand your code structure, but usually that problem is solved in the following way:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   ...

   // Initialize UINavigationControllers and push first viewcontrollers for each one

   UIViewController *view1 = [[UIViewController alloc] init];
   UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:view1];
   [view1 release];

   // Same for the second NavigationController 

   ...      

   // Initialize UITabBarController
   UITabBarController tController = [[UITabBarController alloc] init];
   tController.viewControllers = [NSArray arrayWithObjects:nav1, nav2, nil];
   [nav1 release];
   [nav2 release];

   [window addSubview:tController.view];

   ...
}
怀里藏娇 2024-08-09 20:49:44

请参考这里给出的答案。那里还提供了教程链接。祝你好运。

如何:标签栏控制器中的导航控制器

Please Refer the answer given here. A tutorial link is also provided there. Best of luck.

How to : Navigation Controller in Tab Bar Controller

醉南桥 2024-08-09 20:49:44

您的第二个代码片段位于哪个文件中?可能是 self.navigationController 没有引用您认为它引用的导航控制器。

What file does your second code snippet live in? It might be that self.navigationController doesn't refer to the navigation controller you think it does.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文