0

UINavigation在委托类中使用控制器。在第三个视图类上导航两个视图类后,我需要一个tabbar控制器,它可以控制另外三个ViewControllers,并且在前两个视图控制器上不应该看到标签栏。我怎样才能做到这一点 ?

- (void)viewDidLoad
{

    [super viewDidLoad];

    self.title =@"Scan";

    tabController =[[UITabBarController alloc]init];

    ScanTicketView *scan =[[ScanTicketView alloc]initWithNibName:@"ScanTicketView" bundle:nil];

    SearchView *search =[[SearchView alloc]initWithNibName:@"SearchView" bundle:nil];

    HistoryView *history =[[HistoryView alloc]initWithNibName:@"HistoryView" bundle:nil];

   tabController.viewControllers=[NSArray arrayWithObjects:scan,search,history, nil];

    [self presentModalViewController:tabController animated:YES];

}
4

3 回答 3

1

按照我的回答...您可以随时添加和删除 tabBar
链接

于 2012-09-24T10:23:29.167 回答
0

是的你可以。请参阅此链接的示例

在您想要推送给您的第三个视图(选项卡控制器)的第二个视图控制器中执行此操作

UITabBarController *tabBarController=[[UITabBarController alloc]init];
tabBarController.viewControllers=[NSArray arrayWithObjects:firstViewController,secondViewController,thirdViewController, nil];
//[self.navigationController pushViewController:tabBarController animated:YES];// this works too but since it seems to be against Apple's Human interface Guidelines you can present the view instead of pushing
[self presentModalViewController:tabBarController animated:NO];
于 2012-09-24T10:06:49.097 回答
0

理想情况下,TabBarcontroller 应该是应用程序的起始案例。但在极少数情况下,您希望在视图控制器中显示它,请遵循 ..

 UITabBarController *tabBarController=[[UITabBarController alloc]init];
    tabBarController.viewControllers=[NSArray arrayWithObjects:firstViewController,secondViewController,thirdViewController, nil];

    [self presentModalViewController:tabBarController animated:NO];
于 2012-09-24T10:28:09.747 回答