YBNavigationController.m 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // TCViewController.m
  3. // TCLVBIMDemo
  4. //
  5. // Created by annidyfeng on 16/7/29.
  6. // Copyright © 2016年 tencent. All rights reserved.
  7. //
  8. #import "YBNavigationController.h"
  9. #import "UIImage+Additions.h"
  10. @interface YBNavigationController ()
  11. @end
  12. @implementation YBNavigationController
  13. - (void)viewDidLoad {
  14. [super viewDidLoad];
  15. }
  16. - (void)didReceiveMemoryWarning {
  17. [super didReceiveMemoryWarning];
  18. // Dispose of any resources that can be recreated.
  19. }
  20. /*
  21. #pragma mark - Navigation
  22. // In a storyboard-based application, you will often want to do a little preparation before navigation
  23. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  24. // Get the new view controller using [segue destinationViewController].
  25. // Pass the selected object to the new view controller.
  26. }
  27. */
  28. + (void)initialize
  29. {
  30. if (self == [YBNavigationController class]) {
  31. UINavigationBar *bar = [UINavigationBar appearance];
  32. [bar setBackgroundColor:UIColorFromRGB(0xF5F5F5)];
  33. [bar setTintColor:[UIColor blackColor]];
  34. [bar setBarTintColor: UIColorFromRGB(0xF5F5F5)];
  35. [bar setTitleTextAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x000000)}];
  36. }
  37. }
  38. - (UIInterfaceOrientationMask)supportedInterfaceOrientations
  39. {
  40. return [self.viewControllers.lastObject supportedInterfaceOrientations];
  41. }
  42. - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
  43. {
  44. return [self.viewControllers.lastObject preferredInterfaceOrientationForPresentation];
  45. }
  46. - (BOOL)shouldAutorotate
  47. {
  48. BOOL rorate = [self.viewControllers.lastObject shouldAutorotate];
  49. return rorate;
  50. }
  51. //ios5.0 横竖屏
  52. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
  53. {
  54. return [self shouldAutorotate];
  55. }
  56. - (UIViewController *)childViewControllerForStatusBarStyle {
  57. return self.topViewController;
  58. }
  59. - (UIViewController *)childViewControllerForStatusBarHidden {
  60. return self.topViewController;
  61. }
  62. - (UIStatusBarStyle)preferredStatusBarStyle {
  63. return UIStatusBarStyleLightContent;
  64. }
  65. @end