Tencent / QMUI_iOS

QMUI iOS——致力于提高项目 UI 开发效率的解决方案
http://qmuiteam.com/ios
Other
7.08k stars 1.38k forks source link

使用QDTabBarViewController Tabbar点击后隐藏 #43

Closed TrevorYS closed 7 years ago

TrevorYS commented 7 years ago

运行环境

具体问题描述

*QDTabBarViewController tabBarViewController = [[QDTabBarViewController alloc] init];

//首页
HomeViewController *homeVC = [HomeViewController new];
QDNavigationController *homeNavController = [[QDNavigationController alloc] initWithRootViewController:homeVC];
homeNavController.hidesBottomBarWhenPushed = NO;
homeNavController.tabBarItem = [QDUIHelper tabBarItemWithTitle:@"首页" image:[UIImageMake(@"wdsy") imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:UIImageMake(@"sysyl") tag:0];

//咨询
ConsultViewController *consultVC = [ConsultViewController new];
QDNavigationController *consultNavController = [[QDNavigationController alloc] initWithRootViewController:consultVC];
consultNavController.hidesBottomBarWhenPushed = NO;
consultNavController.tabBarItem = [QDUIHelper tabBarItemWithTitle:@"咨询" image:[UIImageMake(@"syzx") imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:UIImageMake(@"syzxs") tag:0];

//客户
ClientViewController *clientVC = [ClientViewController new];
QDNavigationController *clientNavController = [[QDNavigationController alloc] initWithRootViewController:clientVC];
clientNavController.hidesBottomBarWhenPushed = NO;
clientNavController.tabBarItem = [QDUIHelper tabBarItemWithTitle:@"客户" image:[UIImageMake(@"sykf") imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:UIImageMake(@"sykfs") tag:0];

//我的
SettingViewController *myVC = [SettingViewController new];
QDNavigationController *myNavController = [[QDNavigationController alloc] initWithRootViewController:myVC];
myNavController.hidesBottomBarWhenPushed = NO;
myNavController.tabBarItem = [QDUIHelper tabBarItemWithTitle:@"我的" image:[UIImageMake(@"sysz") imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:UIImageMake(@"wdsz1") tag:0];

tabBarViewController.viewControllers = @[homeNavController, consultNavController, clientNavController, myNavController];
self.window.rootViewController = tabBarViewController;** 

SettingViewController、ClientViewController、HomeViewController、ConsultViewController控制器都继承与QMUICommonViewController,在点击tabbar的时候tabbar就消失了,就出不来了。如下图

问题截图

d127f46b-abcb-462c-b05b-bf601a367569

TrevorYS commented 7 years ago

86246448-5697-4eb3-a556-f663bc07d8f1 第一次能加载出来,点击tabbar后就隐藏了

MoLice commented 7 years ago

你的意思是点击第4个 tabBarItemtabBar 就被隐藏了?还是说点击 SettingViewController 列表里的某个 cell 进入到下一级界面时,tabBar 隐藏了?

TrevorYS commented 7 years ago

@MoLice 点击首页或者咨询、客户都会出现tabbar被隐藏掉

TrevorYS commented 7 years ago

@MoLice 我搞了一个GIF动态图 你看下

1

MoLice commented 7 years ago

这是 hidesBottomBarWhenPushed 属性错误设置导致的。你原本是设置在 UINavigationController 上,应该设置在 UIViewController 上。例如:

SettingViewController *myVC = [SettingViewController new];
myVC.hidesBottomBarWhenPushed = NO;
QDNavigationController *myNavController = [[QDNavigationController alloc] initWithRootViewController:myVC];
TrevorYS commented 7 years ago

是我复制的时候复制错了。。没看出来。。不好意思