1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- //
- // DRNavigationController.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/1/16.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "DRNavigationController.h"
- @interface DRNavigationController ()<UIGestureRecognizerDelegate>
- @end
- @implementation DRNavigationController
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.navigationBar.hidden = YES;
- }
- #pragma mark - UIKit
- - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
-
- // 解决push到子控制器时tabbar不隐藏的问题
- if (self.viewControllers.count > 0) {
- viewController.hidesBottomBarWhenPushed = YES;
-
- }
-
- [super pushViewController:viewController animated:animated];
- }
- - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
-
- // 当返回到根视图控制器时,就不需要滑动返回了,需要禁用,不然会出现程序卡顿现象
- if (self.viewControllers.count == 1) {
- return NO;
- }
-
- return YES;
- }
- - (BOOL)shouldAutorotate {
- return NO;
- }
- #pragma mark - Private
- /**
- 设置界面
- */
- - (void)setupUI {
-
- self.view.backgroundColor = [UIColor whiteColor];
-
- //取消navigationBar下分界线
- [self.navigationBar setShadowImage:[UIImage new]];
- [self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
-
- self.navigationBar.translucent = NO;
-
- //设置navigationBar的颜色
- self.navigationBar.barTintColor = [UIColor baseColor];
-
- //解决边缘右滑手势失效
- self.interactivePopGestureRecognizer.delegate = self;
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|