在做聊天App的时候,Tab Bar controller推出的界面不需要下面的tabbar了,这种问题怎么处理
方法一:
-(void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIStoryboard *sb=[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
UIViewController *vc=[sb instantiateViewControllerWithIdentifier:@"FriendsViewController"];
[self.navigationController pushViewController:vc animated:YES];
self.buddy=self.marr[indexPath.row];
[vc setValue:self.buddy.username forKey:@"contacts"];
[vc setHidesBottomBarWhenPushed:YES];//把推出的ViewController隐藏Tabbar
// 略有卡顿
}
方法二:
-(void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIStoryboard *sb=[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
UIViewController *vc=[sb instantiateViewControllerWithIdentifier:@"FriendsViewController"];
[self.navigationController pushViewController:vc animated:YES];
self.buddy=self.marr[indexPath.row];
[vc setValue:self.buddy.username forKey:@"contacts"];
}
-(void)viewWillAppear:(BOOL)animated
{
self.tabBarController.tabBar.hidden=YES;
}
//视图将要出现的时候,隐藏掉<span style="font-family: Arial, Helvetica, sans-serif;">tabBar</span>
方法一比较简便,但是不推荐.
因为在测试中,会有略有卡顿.