隐藏横向中的Tabbar而不推送到NavigationController

时间:2012-12-12 11:44:34

标签: iphone objective-c ios5 uitabbarcontroller

我想在横向中显示没有Tabbar的另一个视图。 所以我创建了一个新视图,只更改了self.view

self.hidesBottomBarWhenPushed = YES;

但它对我不起作用。希望有人可以帮忙吗?

2 个答案:

答案 0 :(得分:0)

只需在视图的viewWillAppear:方法中添加此行即可隐藏UITabBar

[self.tabBarController.tabBar setHidden:YES];

并且将新视图设置为RootViewController只需使用下面的代码...

YourNewViewController *objView = [[YourNewViewController alloc] initWithNibName:@"YourNewViewController" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:objView]; 
[self presentModalViewController:nav animated:YES];

答案 1 :(得分:0)

如果您不想推送navigationController,请尝试以下代码:

UINavigationController *navAddEvent = [[UINavigationController alloc] initWithRootViewController:yourObg];

        navAddEvent.navigationBar.hidden = TRUE;

        [self presentModalViewController:navAddEvent animated:YES];