Iphone U导航控制器和UIT ABB控制器连接件
我搜索了又搜索,但仍然无法解决这个ole问题!:-( 我的main.xib中有一个TabBarController,它是用五个ViewController设置的 我正在尝试将第一个viewcontroller设置为导航控制器,这样,如果选择了第一个选项卡,我就可以将视图推送到视图中 但就我的生命而言,我不能让它工作 我在我的应用程序启动方法中尝试了以下方法:Iphone U导航控制器和UIT ABB控制器连接件,iphone,uinavigationcontroller,uitabbarcontroller,uitabbaritem,Iphone,Uinavigationcontroller,Uitabbarcontroller,Uitabbaritem,我搜索了又搜索,但仍然无法解决这个ole问题!:-( 我的main.xib中有一个TabBarController,它是用五个ViewController设置的 我正在尝试将第一个viewcontroller设置为导航控制器,这样,如果选择了第一个选项卡,我就可以将视图推送到视图中 但就我的生命而言,我不能让它工作 我在我的应用程序启动方法中尝试了以下方法: UITabBarController *tabBarController = [[UITabBarController alloc] in
UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.delegate=self;
FirstViewController *first = [[FirstViewController alloc] initWithNibName:@"FirstView" bundle:[NSBundle mainBundle]];
UINavigationController *firstNav = [[UINavigationController alloc] initWithRootViewController:first];
NSArray* controllers = [NSArray arrayWithObjects:firstNav, nil];
tabBarController.viewControllers = controllers;
[window addSubview:tabBarController.view];
我看到我的视图显示,但选项卡栏上没有按钮
请提供任何提示??thnx下面是解释如何设置tabbar控制器和导航控制器的链接
希望它能帮助您……为此,您必须以编程方式在选项卡栏中添加视图控制器。如下所示:
[first.tabBarItem initWithTitle:@"First" image:[UIImage imageNamed:@"first.png"] tag:0];
oFirstViewController.title = @"First View";
oFirstViewController.tabBarItem.image = [UIImage imageNamed:@"ico.png"];
UINavigationController *myNavigationController1 = [[UINavigationController alloc] initWithRootViewController:oFirstViewController];
tabBarController.viewControllers = [NSArray arrayWithObjects:myNavigationController1, myNavigationController2, myNavigationController3, myNavigationController4, nil];
这样,您必须将剩余的视图控制器添加到选项卡栏控制器中
希望这对你有帮助
如果有任何困难,请告诉我。您的tabBarController只包含一个viewController。因此,tabBarController中只有一个tabBarItem可用。由于只有一个viewController可用,默认情况下,该tabBarItem将被选中,您无法更改选择。因此,您不会觉得有按钮。但它是您可以设置viewController的标题和图像,您将看到不同之处
first.title = @"firstTab";
first.navigationItem.image = [UIImage imageNamed:@"firstTab.png"];
茶青!谢谢巴德;-)也谢谢所有回应的人,谢谢;-)