UASBaseVC.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // UASBaseVC.m
  3. // shiku_im
  4. //
  5. // Created by ime on 2017/9/22.
  6. //
  7. #import "UASBaseVC.h"
  8. @interface UASBaseVC ()
  9. @end
  10. @implementation UASBaseVC
  11. - (void)viewDidLoad {
  12. [super viewDidLoad];
  13. self.view.backgroundColor = BGB_COLOR;
  14. if (self.navigationController) {
  15. [self setLeftView];
  16. }
  17. self.noDataV = [[UIView alloc]initWithFrame:self.view.frame];
  18. [self.view addSubview:self.noDataV];
  19. self.noDataV.hidden = YES;
  20. UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"crm_all_noData"]];
  21. [self.noDataV addSubview:imageView];
  22. [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
  23. make.centerX.equalTo(self.noDataV);
  24. make.centerY.equalTo(self.noDataV).offset(-30);
  25. make.height.mas_equalTo(126);
  26. make.width.mas_equalTo(100);
  27. }];
  28. [self createUI];
  29. }
  30. -(void)createUI{
  31. }
  32. -(void)setLeftView{
  33. UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
  34. btn.frame = CGRectMake(0, 5, 22, 22);
  35. CGFloat imageY = 0;
  36. if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.0) {
  37. imageY = 5;
  38. }
  39. UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(0, imageY, 22, 22)];
  40. image.image = [UIImage imageNamed:@"icon_back_nor3"];
  41. [btn addSubview:image];
  42. [btn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  43. UIBarButtonItem *bbi2 = [[UIBarButtonItem alloc]initWithCustomView:btn];
  44. self.navigationItem.leftBarButtonItems = @[bbi2];
  45. }
  46. - (void)didReceiveMemoryWarning {
  47. [super didReceiveMemoryWarning];
  48. // Dispose of any resources that can be recreated.
  49. }
  50. -(void)backAction{
  51. if (self.navigationController) {
  52. [self.navigationController popViewControllerAnimated:YES];
  53. [SVProgressHUD dismiss];
  54. [MBProgressHUD hideHUD];
  55. }else{
  56. [self dismissViewControllerAnimated:YES completion:nil];
  57. }
  58. }
  59. @end