IWNavigationController.m 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //
  2. // IWNavigationController.m
  3. // ItcastWeibo
  4. //
  5. // Created by mj on 14-1-2.
  6. // Copyright (c) 2014年 itcast. All rights reserved.
  7. //
  8. #import "IWNavigationController.h"
  9. #import "AppDelegate.h"
  10. //#import "UIBarButtonItem+Addition.h"
  11. @interface IWNavigationController ()<UIGestureRecognizerDelegate>
  12. @end
  13. @implementation IWNavigationController
  14. - (void)viewDidLoad
  15. {
  16. [super viewDidLoad];
  17. [UIApplication sharedApplication].statusBarHidden = NO;
  18. }
  19. - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
  20. {
  21. viewController.hidesBottomBarWhenPushed = self.viewControllers.count;
  22. // 当不是压入的不是栈底控制器,就隐藏底部的工具条
  23. // AppDelegate *appDelegate = (AppDelegate *)APPDELEGATE;
  24. // if (self.viewControllers.count) {
  25. // viewController.hidesBottomBarWhenPushed = self.viewControllers.count;
  26. //setPanEnabled
  27. // [appDelegate.LeftSlideVC setPanEnabled:NO];
  28. // }
  29. // else [appDelegate.LeftSlideVC setPanEnabled:YES];
  30. [super pushViewController:viewController animated:animated];
  31. }
  32. //- (void)setViewControllers:(NSArray<UIViewController *> *)viewControllers animated:(BOOL)animated
  33. //{
  34. //
  35. // [super setViewControllers:viewControllers animated:animated];
  36. //}
  37. //- (UIViewController *)popViewControllerAnimated:(BOOL)animated
  38. //{
  39. // if([super popViewControllerAnimated:animated])
  40. // {
  41. // AppDelegate *appDelegate = (AppDelegate *)APPDELEGATE;
  42. // [appDelegate.LeftSlideVC setPanEnabled:(self.viewControllers.count - 1) <= 1?YES:NO];
  43. // return nil;
  44. // }else return [super popViewControllerAnimated:animated];
  45. //
  46. //}
  47. //- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
  48. //{
  49. //
  50. // NSLog(@"dad");
  51. //}
  52. //- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
  53. //{
  54. // [super navi];
  55. // NSLog(@"dad");
  56. ////
  57. //// viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(back) icon:@"navigationbar_back" highlightedIcon:@"navigationbar_back_highlighted"];
  58. //
  59. //
  60. //// if (viewController != navigationController.viewControllers[0] && viewController.navigationItem.leftBarButtonItem == nil) {
  61. //// viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(back) icon:@"navigationbar_back" highlightedIcon:@"navigationbar_back_highlighted"];
  62. ////
  63. //// }
  64. //
  65. //}
  66. - (void)back
  67. {
  68. [self dismissViewControllerAnimated:YES completion:nil];
  69. }
  70. - (void)more
  71. {
  72. [self popToRootViewControllerAnimated:YES];
  73. }
  74. - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
  75. {
  76. return YES;
  77. }
  78. @end