【问题标题】:what are connections need to to be done for tab bar controller in the main window.xib?主window.xib中的标签栏控制器需要做哪些连接?
【发布时间】:2012-01-20 21:08:38
【问题描述】:

帮助我解决需要在 mainwindow.xib 中完成的连接,以便标签栏控制器在标签栏项目之间切换。 我已将应用程序委托连接到选项卡栏控制器。 但是单击标签栏按钮时无法切换多个视图

【问题讨论】:

    标签: iphone eclipse iphone-sdk-3.0 iphone-sdk-3.2 tabbarcontroller


    【解决方案1】:

    假设您的 tabBarController 上有 2 个选项卡。

    在您的 appDelegate 函数中

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
      UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
    
        UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
    
      self.tabBarController = [[UITabBarController alloc] init];
    
       self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2,nil];
    
         self.window.rootViewController = self.tabBarController;
         [self.window makeKeyAndVisible];
    
    
    }
    

    这样你就可以轻松地绑定你的tabBarController。 注意:不要忘记在 appDelegate.h 文件中声明 tabBarController。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-02
      • 2015-04-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多