FWZViewController.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // FWZViewController.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/11/8.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "FWZViewController.h"
  9. #import "TDNavigationBar.h"
  10. #import "DrawerView.h"
  11. @interface FWZViewController ()<TDNavigationBarDelegate>
  12. @end
  13. @implementation FWZViewController
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. [self.view addSubview:self.myBackImageView];
  17. [self.view addSubview:self.myNavigationBar];
  18. self.fd_prefersNavigationBarHidden = YES;
  19. self.myNavigationBar.titleLabel.text = self.title;
  20. self.myNavigationBar.titleLabel.font = [UIFont systemFontOfSize:19.0];
  21. }
  22. #pragma mark - 导航栏事件处理
  23. -(void)back{
  24. if (self.navigationController.viewControllers.count > 1) {
  25. [self.navigationController popViewControllerAnimated:YES];
  26. }else{
  27. [self dismissViewControllerAnimated:YES completion:nil];
  28. }
  29. }
  30. - (void)secondBarButtonItems:(TDButton *)sender{
  31. DrawerView *vi = [[DrawerView alloc] initWithFrame:self.view.bounds];
  32. [self.view addSubview:vi];
  33. }
  34. - (void)backButtonAction {
  35. [self back];
  36. }
  37. - (void)backButtonAction2:(TDButton *)sender{
  38. [self secondBarButtonItems:sender];
  39. }
  40. - (void)rightButtonAction:(nonnull TDButton *)sender {
  41. }
  42. #pragma mark - setter
  43. - (TDNavigationBar *)myNavigationBar{
  44. if (!_myNavigationBar) {
  45. _myNavigationBar = [[TDNavigationBar alloc]initNavigationBar];
  46. _myNavigationBar.delegate = self;
  47. _myNavigationBar.backButton2.hidden = NO;
  48. _myNavigationBar.titleLabel.textColor = UIColorHex(#0A0A0A);
  49. _myNavigationBar.titleLabel.font = [UIFont systemFontOfSize:18.f];
  50. [_myNavigationBar.backButton2 setImage:IMG(@"icon_menu") forState:UIControlStateNormal];
  51. [_myNavigationBar.backButton setImage:IMG(@"首页-书籍详情-返回") forState:UIControlStateNormal];
  52. }
  53. return _myNavigationBar;
  54. }
  55. - (UIView *)myBackImageView{
  56. if (!_myBackImageView) {
  57. _myBackImageView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kGXScreenHeigh, kNavigationHeight)];
  58. _myBackImageView.backgroundColor = [UIColor colorWithRed:92/255.0 green:118.0/255.0 blue:167.0/255.f alpha:1.0];
  59. _myBackImageView.hidden = YES;
  60. }
  61. return _myBackImageView;
  62. }
  63. @end