隐藏自定义的tabbar之后,push到B视图,B视图的键盘工具条无法响应点击事件

我的情况如下:

在TabbarViewController中隐藏了系统的tabbar,然后自定义tabbar,A B C D 4个视图都有UINavigationController,A视图
使用的是系统的navigationBar,当我从A视图push到E视图时(E视图是集成第三方SDK的一个聊天视图),用通知调用TabbarViewController中的方法隐藏自定义的tabbar(只是把自定义的tabbar设置为透明),E视图显示出来之后,底部的键盘工具条就无法响应点击事件。

解决办法:
在push E视图和隐藏tabbar之前,调用self.hidesBottomBarWhenPushed = YES;此代码即可。

1.A视图中的代码

- (void)intoIMViewAction { // 连接融云服务器。 [RCIM connectWithToken:@"R5VbVCZPymx9VmrBgXazha6F/1JNAtpfQVLte3UHrvBll5ZeTNTb5YfiWJtO7CWraSA9fznUchgGcGTyrt30Jw==" completion:^(NSString *userId) { // 此处处理连接成功。 NSLog(@"Login successfully with userId: %@.", userId); // 创建单聊视图控制器。 RCChatViewController *chatViewController = [[RCIM sharedRCIM]createPrivateChat:@"1" title:@"自问自答" completion:^(){ // 创建 ViewController 后,调用的 Block,可以用来实现自定义行为。 }]; // 把单聊视图控制器添加到导航栈。 self.hidesBottomBarWhenPushed = YES; [self pushVcWithViewController:chatViewController]; } error:^(RCConnectErrorCode status) { // 此处处理连接错误。 NSLog(@"Login failed."); }]; } #pragma mark - push视图之前隐藏tabbar - (void)pushVcWithViewController:(UIViewController *)vc { if (isIOS6) { [self setHidesBottomBarWhenPushed:YES]; } [self.navigationController pushViewController:vc animated:YES]; [[NSNotificationCenter defaultCenter]postNotificationName:@"hideTabBar" object:self]; }
2.TabbarViewController中的方法:

#pragma
mark - 隐藏tabBar - (void)hideTabBar { _myTabBar.alpha = 0; //_myTabBar.backgroundColor = [UIColor clearColor]; }
原文地址:https://www.cnblogs.com/hw140430/p/4062804.html