1

我已经有了实用程序应用程序的基本代码,但是当应用程序翻转到第二个视图时,我只想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];
}
4

3 回答 3

1

显示/设置是指在视图上添加标签栏控制器吗?好吧,我假设..您可以将标签栏控制器添加为窗口的根视图控制器,即您的 AppDelegate。这是示例代码:

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;
于 2012-06-06T07:04:21.320 回答
1

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

[yourTabBar setHidden :YES];

并使用以下代码显示它

[yourTabBar setHidden:NO];

于 2012-06-06T06:03:35.637 回答
0

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

于 2012-06-06T07:10:09.047 回答