如何仅向翻转视图添加标签栏

时间:2012-06-06 05:51:10

标签: iphone ios xcode tabbar

我已经有了实用程序应用程序的基本代码,但是当应用程序翻转到第二个视图时,我只想在翻转视图的底部添加tabbarItem,如果视图被翻转回到原始视图标签栏不应显示。如何添加此功能,顺便说一下,我正在使用模拟器4.1,谢谢!

这是显示单击按钮时翻转面的代码,我希望它转换为标签栏控制器。

- (IBAction)showInfo:(id)sender {    

    FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
    controller.delegate = self;

    controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:controller animated:YES];

    [controller release];
}

3 个答案:

答案 0 :(得分:1)

您可以使用以下代码隐藏UITabbar

[yourTabBar setHidden :YES];

并使用以下代码显示它

[yourTabBar setHidden:NO];

答案 1 :(得分:1)

通过显示/设置你的意思是在视图上添加tabbar控制器吗?我假设你...你可以添加tabbar控制器作为你的窗口的rootviewcontroller,即你的AppDelegate.Here是示例代码:

UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UINavigationController *navCon1=[[UINavigationController alloc] initWithRootViewController:viewController1];

UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
UINavigationController *navCon2=[[UINavigationController alloc] initWithRootViewController:viewController2];

UIViewController *viewController3=[[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
UINavigationController *navCon3=[[UINavigationController alloc] initWithRootViewController:viewController3];

self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:navCon1, navCon2,navCon3, nil];

self.window.rootViewController = self.tabBarController;

答案 2 :(得分:0)

你在两个UIViewControllers之间切换,对吗?让翻转后出现的第二个视图控制器为UITabBarViewController