NavigationController.m 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // NavigationController.m
  3. // TCXF
  4. //
  5. // Created by 张毅成 on 2017/6/22.
  6. // Copyright © 2017年 张毅成. All rights reserved.
  7. //
  8. #import "NavigationController.h"
  9. @interface NavigationController ()
  10. @end
  11. @implementation NavigationController
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. }
  15. + (void)load {
  16. //设置导航条的样式
  17. UINavigationBar *navBar = [UINavigationBar appearance];
  18. // 取出导航条item的外观对象(主题对象)
  19. // navBar.barTintColor = basicColorDark;
  20. [navBar setBackgroundImage:[UIImage imageWithBgColor:[UIColor whiteColor] alpha:1.0] forBarMetrics:UIBarMetricsDefault];
  21. // [navBar setShadowImage:[UIImage new]];
  22. [navBar setShadowImage:[UIImage imageWithColor:[UIColor whiteColor]]];
  23. [navBar setTitleTextAttributes:
  24. @{NSFontAttributeName:[UIFont systemFontOfSize:16],
  25. NSForegroundColorAttributeName:[UIColor blackColor]}];
  26. navBar.tintColor = [UIColor blackColor];
  27. UIBarButtonItem *item = [UIBarButtonItem appearance];
  28. // 设置默认状态文字的颜色
  29. NSMutableDictionary *md = [NSMutableDictionary dictionary];
  30. md[NSForegroundColorAttributeName] = [UIColor whiteColor];
  31. md[NSFontAttributeName] = [UIFont systemFontOfSize:16];
  32. [item setTitleTextAttributes:md forState:UIControlStateNormal];
  33. // 设置高亮状态文字的颜色
  34. NSMutableDictionary *higMd = [NSMutableDictionary dictionary];
  35. higMd[NSForegroundColorAttributeName] = [UIColor whiteColor];
  36. higMd[NSFontAttributeName] = [UIFont systemFontOfSize:16];
  37. [item setTitleTextAttributes:higMd forState:UIControlStateHighlighted];
  38. // 设置不可用状态的颜色
  39. NSMutableDictionary *disMd = [NSMutableDictionary dictionary];
  40. disMd[NSForegroundColorAttributeName] = [UIColor whiteColor];
  41. disMd[NSFontAttributeName] = [UIFont systemFontOfSize:16];
  42. [item setTitleTextAttributes:disMd forState:UIControlStateDisabled];
  43. }
  44. - (void)didReceiveMemoryWarning {
  45. [super didReceiveMemoryWarning];
  46. // Dispose of any resources that can be recreated.
  47. }
  48. @end