酷店

KDPMainViewController.m 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // KDPMainViewController.m
  3. // KuDianProject
  4. //
  5. // Created by 学丽 on 2019/7/4.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPMainViewController.h"
  9. @interface KDPMainViewController ()
  10. @end
  11. @implementation KDPMainViewController
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. [self.view addSubview:self.navBar];
  15. }
  16. -(void)viewWillLayoutSubviews
  17. {
  18. self.view.frame=[UIScreen mainScreen].bounds;
  19. }
  20. -(void)viewWillAppear:(BOOL)animated
  21. {
  22. [super viewWillAppear:animated];
  23. self.navigationController.navigationBar.hidden=YES;
  24. [self.view bringSubviewToFront:self.navBar];
  25. }
  26. -(KDPNavBar *)navBar
  27. {
  28. if (!_navBar) {
  29. _navBar=[[KDPNavBar alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, KDNavBarHeight)];
  30. //代码写在这个里面
  31. @try{
  32. _navBar.backgroundColor=[UIColor gradientOneColor:[UIColor colorWithHexString:@"#FF235F"] toColor:[UIColor colorWithHexString:@"#FF7676"] Width:SCREEN_WIDTH];
  33. }
  34. @catch(NSException *exception) {
  35. NSLog(@"异常错误是:%@", exception);
  36. }
  37. @finally {
  38. }
  39. }
  40. return _navBar;
  41. }
  42. @end