如何隐藏在标签点击标签栏在iPhone应用程序
问题描述:
HII每一个如何隐藏在标签点击标签栏在iPhone应用程序
我做了多视图的应用程序,因为我有4个选项卡,, &我在每个选项卡视图控制器,在一个选项卡中,我已经分组了表格视图控制器,点击该选项卡它将进入该分组表格视图,每一件事情都很好,但表格的最后一行隐藏在标签栏下,所以我需要隐藏标签栏当我进入该屏幕,我怎么能做到这一点,,任何一个可以帮助我
我在AppDelegate中使用这种以编程方式创建标签,
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UINavigationController *localNavigationController;
tabBarController = [[UITabBarController alloc] init];
NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:5];
//add first tab View Controller
RootViewController *ViewController;
ViewController = [[RootViewController alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:ViewController];
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[ViewController release];
//add second tab View Controller
StudentDataEntry *GroupViewController;
GroupViewController = [[StudentDataEntry alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc]
initWithRootViewController:GroupViewController];
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[GroupViewController release];
}
thanx提前
答
如果你的最后一行是不是在你的视图中可见那么就没有必要隐藏标签栏为您已按照让你的表视图高度,标签栏是48 PX如此从桌面视图高度减去这个48像素高度,并且如果顶部有一个导航栏,那么也会从高度减去44个像素,然后它将可见。此外,您还可以为表格视图设置内容插入以使其可见。
答
试试这个
yourviewcontroller.hidesBottomBarWhenPushed=YES;
答
我希望这可以帮助您
BOOL hiddenTabBar = NO;
- (void) hidetabbar {
NSArray *array = self.tabBarController.view.subviews;
NSLog(@"array SubView %@",array);
[UIView animateWithDuration:1.0 delay:0.0f options:UIViewAnimationCurveLinear animations:^(){
for(UIView *view in self.tabBarController.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
if (hiddenTabBar) {
[view setFrame:CGRectMake(view.frame.origin.x, 431, view.frame.size.width, view.frame.size.height)];
} else {
[view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
}
} else {
if (hiddenTabBar) {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 431)];
} else {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
}
}
}
} completion:^(BOOL isfinsihed){
hiddenTabBar = !hiddenTabBar;
}];
}
雅真的作品,感谢名单了很多 – Ravi 2011-05-26 04:38:00