Commit 3c3a84303470baf675ad9b81ac2fa9eefdd741f8
1 parent
73dc79a7
tabbar基类调整
Showing
2 changed files
with
13 additions
and
13 deletions
metaCode/Classes/Common/Base/CNLiveBaseNavigationController.swift
| @@ -25,9 +25,9 @@ class CNLiveBaseNavigationController : UINavigationController,UINavigationContro | @@ -25,9 +25,9 @@ class CNLiveBaseNavigationController : UINavigationController,UINavigationContro | ||
| 25 | self.delegate = self as UINavigationControllerDelegate | 25 | self.delegate = self as UINavigationControllerDelegate |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | - // MARK: - <UIGestureRecognizerDelegate> | ||
| 29 | - // 什么时候调用:每次触发手势之前都会询问下代理,是否触发。 | ||
| 30 | - // 作用:拦截手势触发,手势识别器对象会调用这个代理方法来决定手势是否有效 | 28 | +// MARK: - <UIGestureRecognizerDelegate> |
| 29 | +// 什么时候调用:每次触发手势之前都会询问下代理,是否触发。 | ||
| 30 | +// 作用:拦截手势触发,手势识别器对象会调用这个代理方法来决定手势是否有效 | ||
| 31 | override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { | 31 | override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { |
| 32 | 32 | ||
| 33 | return viewControllers.count > 1 | 33 | return viewControllers.count > 1 |
| @@ -47,15 +47,13 @@ class CNLiveBaseNavigationController : UINavigationController,UINavigationContro | @@ -47,15 +47,13 @@ class CNLiveBaseNavigationController : UINavigationController,UINavigationContro | ||
| 47 | 47 | ||
| 48 | /// 重写push方法的目的 : 拦截所有push进来的子控制器 | 48 | /// 重写push方法的目的 : 拦截所有push进来的子控制器 |
| 49 | override func pushViewController(_ viewController: UIViewController, animated: Bool) { | 49 | override func pushViewController(_ viewController: UIViewController, animated: Bool) { |
| 50 | - DispatchQueue.main.async { | ||
| 51 | 50 | ||
| 52 | - if (self.children.count > 0 ) { | ||
| 53 | - // 隐藏底部的工具条 | ||
| 54 | - viewController.hidesBottomBarWhenPushed = true | ||
| 55 | - } | ||
| 56 | - // 所有设置搞定后, 再push控制器 | ||
| 57 | - super.pushViewController(viewController, animated: animated) | 51 | + if (self.children.count > 0 ) { |
| 52 | + // 隐藏底部的工具条 | ||
| 53 | + viewController.hidesBottomBarWhenPushed = true | ||
| 58 | } | 54 | } |
| 55 | + // 所有设置搞定后, 再push控制器 | ||
| 56 | + super.pushViewController(viewController, animated: animated) | ||
| 59 | } | 57 | } |
| 60 | 58 | ||
| 61 | @objc func ClickBackBtn() { | 59 | @objc func ClickBackBtn() { |
metaCode/Classes/Common/Base/CNLiveBaseTabBarViewController.swift
| @@ -68,10 +68,12 @@ class CNLiveBaseTabBarViewController: UITabBarController | @@ -68,10 +68,12 @@ class CNLiveBaseTabBarViewController: UITabBarController | ||
| 68 | 68 | ||
| 69 | self.tabBar.tintColor = UIColor("#0066FE") | 69 | self.tabBar.tintColor = UIColor("#0066FE") |
| 70 | self.tabBar.isTranslucent = false | 70 | self.tabBar.isTranslucent = false |
| 71 | + self.viewControllers = [ | ||
| 72 | + CNLiveBaseNavigationController(rootViewController: homeVC), | ||
| 73 | + CNLiveBaseNavigationController(rootViewController: authVC), | ||
| 74 | + CNLiveBaseNavigationController(rootViewController: mineVC) | ||
| 75 | + ] | ||
| 71 | 76 | ||
| 72 | - self.viewControllers = [CNLiveBaseNavigationController(rootViewController: homeVC),CNLiveBaseNavigationController(rootViewController: authVC),CNLiveBaseNavigationController(rootViewController: mineVC)] | ||
| 73 | - | ||
| 74 | - self.selectedIndex = 0 | ||
| 75 | } | 77 | } |
| 76 | 78 | ||
| 77 | // MARK: - Tabar 背景图 | 79 | // MARK: - Tabar 背景图 |