ModelBaseViewController.m 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // ModelBaseViewController.m
  3. // model
  4. //
  5. // Created by JuYi on 2018/7/16.
  6. // Copyright © 2018年 Mine. All rights reserved.
  7. //
  8. #import "ModelBaseViewController.h"
  9. @interface ModelBaseViewController ()
  10. @end
  11. @implementation ModelBaseViewController
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. // Do any additional setup after loading the view.
  15. [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"baise1"] forBarMetrics:(UIBarMetricsDefault)];
  16. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  17. btn.frame = CGRectMake(0, 0, 40, 40);
  18. [btn setImage:[UIImage imageNamed:@"fanhui2"] forState:UIControlStateNormal];
  19. btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0); // backBtn2
  20. [btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
  21. UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
  22. UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
  23. // nagetiveSpacer.width = -12;//这个值可以根据自己需要自己调整
  24. self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem];
  25. }
  26. - (void)backClick {
  27. [self.navigationController popViewControllerAnimated:YES];
  28. }
  29. - (UIStatusBarStyle)preferredStatusBarStyle{
  30. return UIStatusBarStyleLightContent;
  31. }
  32. - (void)didReceiveMemoryWarning {
  33. [super didReceiveMemoryWarning];
  34. // Dispose of any resources that can be recreated.
  35. }
  36. /*
  37. #pragma mark - Navigation
  38. // In a storyboard-based application, you will often want to do a little preparation before navigation
  39. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  40. // Get the new view controller using [segue destinationViewController].
  41. // Pass the selected object to the new view controller.
  42. }
  43. */
  44. @end