【问题标题】:Issue with pushing UIViewController on UITabbarController在 UITabbarController 上推送 UIViewController 的问题
【发布时间】:2011-12-05 14:02:01
【问题描述】:

我已经实现了 UINavigationController 和 UITabbarController 。我可以看到导航栏和标签栏以及 UIViewController。

问题是当我在此控制器上推送任何其他 UIViewController 时,该视图控制器被推送但 Tabbar 消失了。

是否有任何规定可以将 UITabBar 沿堆栈保留????

下面是我指的代码

UIViewController* cont1 = [UIViewController alloc]init];
UIViewController* cont2 = [UIViewController alloc]init];

[tabBarController setViewControllers:[NSArray arrayWithObjects:cont1,cont2,nil]];

谢谢。

【问题讨论】:

    标签: iphone


    【解决方案1】:

    你应该反过来做。 在UITabbarController 中的每个UIViewController 中放置一个UINavigationController。

    【讨论】:

      【解决方案2】:
      YourViewController *viewController = [YourViewController alloc] init] autorelease];
      UINavigationController *controller = [UINavigationController alloc] initWithRootViewController:viewController] autorelease];
      controller.title = @"something";
      controller.tabBarItem.image = [UIImage imageNamed:@"xx"];
      tabController.viewControllers = [NSArray arrayWithObject:controller];
      

      然后您可以将子视图控制器推送到导航控制器中,并在屏幕底部保持标签栏。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多