当我在顶部使用TabBarController时显示底部的空白空间

时间:2013-10-15 10:59:59

标签: iphone ios objective-c xcode uitabbarcontroller

enter image description here

当我在屏幕顶部有UITabBarController时,底部会出现空白空间。在iOS7中,它正在使用此代码

       self.edgesForExtendedLayout=UIRectEdgeBottom;
    self.extendedLayoutIncludesOpaqueBars = YES;

//在ios 6中获取空格的地方。下面是我用来显示tabbar的代码

    appDelegate.tabBarController.tabBar.frame = CGRectMake(0, 20, 320, 50);
appDelegate.tabBarController.delegate=self;

UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, -20, 320, 600)];

viewControllers = [[NSMutableArray alloc] init];

TagViewController *view1 = [[TagViewController alloc] init];
UINavigationController *nav1=[[UINavigationController alloc]initWithRootViewController:view1];
[viewControllers addObject:nav1];

ContactsViewController *view2 = [[ContactsViewController alloc] init];
UINavigationController *nav2=[[UINavigationController alloc]initWithRootViewController:view2];
[viewControllers addObject:nav2];

MessagesViewController *view3 = [[MessagesViewController alloc] init];
UINavigationController *nav3=[[UINavigationController alloc]initWithRootViewController:view3];
[viewControllers addObject:nav3];

RewardsViewController *view4 = [[RewardsViewController alloc] init];
UINavigationController *nav4=[[UINavigationController alloc]initWithRootViewController:view4];
[viewControllers addObject:nav4];

SettingsViewController *view5 = [[SettingsViewController alloc] init];
UINavigationController *nav5=[[UINavigationController alloc]initWithRootViewController:view5];
[viewControllers addObject:nav5];

[appDelegate.tabBarController setViewControllers:viewControllers];

appDelegate.tabBarController.tabBarController.view.frame=CGRectMake(0, 0, 320, 480);
[view addSubview:appDelegate.tabBarController.view];

[self.view addSubview:view];

1 个答案:

答案 0 :(得分:0)

在viewWillAppear中尝试此代码:

self.tabBarController.tabBar.hidden = YES;

[self.tabBarController.tabBar setHidden:YES];