<small id='V9eSe'></small><noframes id='V9eSe'>

    <tfoot id='V9eSe'></tfoot>
    • <bdo id='V9eSe'></bdo><ul id='V9eSe'></ul>
    <i id='V9eSe'><tr id='V9eSe'><dt id='V9eSe'><q id='V9eSe'><span id='V9eSe'><b id='V9eSe'><form id='V9eSe'><ins id='V9eSe'></ins><ul id='V9eSe'></ul><sub id='V9eSe'></sub></form><legend id='V9eSe'></legend><bdo id='V9eSe'><pre id='V9eSe'><center id='V9eSe'></center></pre></bdo></b><th id='V9eSe'></th></span></q></dt></tr></i><div id='V9eSe'><tfoot id='V9eSe'></tfoot><dl id='V9eSe'><fieldset id='V9eSe'></fieldset></dl></div>

        <legend id='V9eSe'><style id='V9eSe'><dir id='V9eSe'><q id='V9eSe'></q></dir></style></legend>

      1. 结合导航控制器和标签栏控制器

        时间:2023-06-12
          <tbody id='jQUa2'></tbody>
      2. <i id='jQUa2'><tr id='jQUa2'><dt id='jQUa2'><q id='jQUa2'><span id='jQUa2'><b id='jQUa2'><form id='jQUa2'><ins id='jQUa2'></ins><ul id='jQUa2'></ul><sub id='jQUa2'></sub></form><legend id='jQUa2'></legend><bdo id='jQUa2'><pre id='jQUa2'><center id='jQUa2'></center></pre></bdo></b><th id='jQUa2'></th></span></q></dt></tr></i><div id='jQUa2'><tfoot id='jQUa2'></tfoot><dl id='jQUa2'><fieldset id='jQUa2'></fieldset></dl></div>
        <legend id='jQUa2'><style id='jQUa2'><dir id='jQUa2'><q id='jQUa2'></q></dir></style></legend>
            • <bdo id='jQUa2'></bdo><ul id='jQUa2'></ul>

                <small id='jQUa2'></small><noframes id='jQUa2'>

                  <tfoot id='jQUa2'></tfoot>

                1. 本文介绍了结合导航控制器和标签栏控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  正如我在标题中提到的,我想将 Navigation Controller 添加到我已经有 Tab Controller 的应用程序中.因此,尝试在 页.无论如何,有些不对劲.UINavigationController 正在寻找一个空白页面,即使有一个视图和一些库.

                  As I mentioned in the title, I want to add Navigation Controller to my application which already has a Tab Controller. So trying to do the staff something like on this page. Anyway, something is wrong. UINavigationController is looking a blank page, even if has a view and some libraries.

                  让我从头开始:

                  在我的 AppDelegate 中,我正在设置标签栏控制器,如下所示:

                  In my AppDelegate, I'm setting tab bar controllers like this:

                  @interface MYAppDelegate : UIResponder <UIApplicationDelegate>
                  
                  @property (strong, nonatomic) UIWindow *window;
                  @property (strong, nonatomic) UITabBarController *tabBarController;
                  
                  @end
                  

                  这是.m文件:

                  @implementation MYAppDelegate
                  
                  @synthesize window = _window;
                  @synthesize tabBarController = _tabBarController;
                  
                  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
                  {
                      application.applicationSupportsShakeToEdit = YES;
                      self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
                  
                      UINavigationController *viewController1 = [[[MYMainViewController alloc] init] initWithNibName: @"MYMainViewController" bundle:nil];
                      UIViewController *viewController2 = [[[MYPageViewController alloc] init] initWithNibName:@"MYPageViewController" bundle:nil];
                      UIViewController *viewController3 = [[[MYSearchViewController alloc] init] initWithNibName:@"MYSearchViewController" bundle:nil];
                      UIViewController *viewController4 = [[[MYPersonViewController alloc] init] initWithNibName:@"MYPersonViewController" bundle:nil];
                  
                      // Initialize tabBarController and add ViewControllers
                      self.tabBarController = [[UITabBarController alloc] init];
                      self.tabBarController.viewControllers = [NSArray arrayWithObjects: viewController1, viewController2, 
                          viewController3, viewController4, nil];
                  
                      self.window.rootViewController = self.tabBarController;
                      [self.window makeKeyAndVisible];
                  
                      return YES;
                  }
                  

                  然后,这里是 MYMainViewController 实现,它是一个 UINavigationController:

                  Then, here is MYMainViewController implementaion which is a UINavigationController:

                  - (void)viewDidLoad {
                      [super viewDidLoad];
                      NSLog(@"%@", [self navigationController]); // Logging null
                  }
                  

                  我的 .xib 文件有一个 UINavigationController 并且其中有一个视图.尽管如此,当我使用该应用程序时,有空白页面和无标题导航栏.我做错了什么?

                  My .xib file has a UINavigationController and and there is a view in it. Althought it, when I worked the app, there is blank page and untitled navigation bar. What am I doing wrong?

                  如果我可以看到我的视图的内容,我想使用后退按钮在两个视图控制器之间导航.

                  If I could see the content of my view, I want to navigate between two view controllers by using back button.

                  任何帮助或方法对我来说都很棒.

                  Any help or approach would be great for me.

                  推荐答案

                  尝试从xib中移除导航控制器,使其只有视图控制器,然后以编程方式初始化导航控制器:

                  Try to remove navigation controller from xib, so it only have view controller, then initialize navigation controller programatically:

                  UIViewController *tmpViewController1 = [[[YourViewController alloc] init] initWithNibName:@"YourViewController" bundle:nil];
                   UINavigationController *viewController1 =  [[UINavigationController alloc] initWithRootViewController:tmpViewController1];
                  

                  这篇关于结合导航控制器和标签栏控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:从弹出的 UINavigationController 或 UITabBarController 确定 viewWill 下一篇:设置 UINavigationBar 的标题

                  相关文章

                  <tfoot id='Qswi8'></tfoot>

                2. <i id='Qswi8'><tr id='Qswi8'><dt id='Qswi8'><q id='Qswi8'><span id='Qswi8'><b id='Qswi8'><form id='Qswi8'><ins id='Qswi8'></ins><ul id='Qswi8'></ul><sub id='Qswi8'></sub></form><legend id='Qswi8'></legend><bdo id='Qswi8'><pre id='Qswi8'><center id='Qswi8'></center></pre></bdo></b><th id='Qswi8'></th></span></q></dt></tr></i><div id='Qswi8'><tfoot id='Qswi8'></tfoot><dl id='Qswi8'><fieldset id='Qswi8'></fieldset></dl></div>
                  • <bdo id='Qswi8'></bdo><ul id='Qswi8'></ul>
                    <legend id='Qswi8'><style id='Qswi8'><dir id='Qswi8'><q id='Qswi8'></q></dir></style></legend>

                      <small id='Qswi8'></small><noframes id='Qswi8'>