XMGMyBaseVC.m 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //
  2. // XMGBaseViewC.m
  3. // 振飞商城
  4. //
  5. // Created by 123 on 2020/5/10.
  6. // Copyright © 2020 Vibration Fly. All rights reserved.
  7. //
  8. #import "XMGMyBaseVC.h"
  9. @interface XMGMyBaseVC ()
  10. @end
  11. @implementation XMGMyBaseVC
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. // Do any additional setup after loading the view.
  15. self.view.backgroundColor=kRGBColor(250, 250, 250);
  16. }
  17. - (void)defineNavBarSiDai:(NSString *)title andRinghtBtnImg:(NSString *)image
  18. {
  19. UIView *navView = [[UIView alloc] init];
  20. [self.view addSubview:navView];
  21. navView.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH,JX_SCREEN_TOP);
  22. UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  23. backBtn.frame = CGRectMake(0,JX_SCREEN_HEIGHT>812?44:20,44, 44);
  24. [backBtn setImage:[UIImage imageNamed:@"photo_title_back_black"] forState:0];
  25. backBtn.tag = 1001;
  26. [backBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
  27. [navView addSubview:backBtn];
  28. UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  29. rightBtn.frame = CGRectMake(100,(JX_SCREEN_HEIGHT>812?44:20), JX_SCREEN_WIDTH-200, 44);
  30. [rightBtn setTitle:title forState:UIControlStateNormal];
  31. [rightBtn setImage:[UIImage imageNamed:title] forState:UIControlStateNormal];
  32. rightBtn.layer.cornerRadius=5;
  33. rightBtn.layer.masksToBounds=YES;
  34. rightBtn.tag =1002;
  35. //[rightBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
  36. [navView addSubview:rightBtn];
  37. self.rightBtn=rightBtn;
  38. }
  39. - (void)defineNavBarXXX:(NSString *)title andRinghtBtnImg:(NSString *)image
  40. {
  41. UIView *navView = [[UIView alloc] init];
  42. [self.view addSubview:navView];
  43. navView.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH,JX_SCREEN_TOP);
  44. UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  45. backBtn.frame = CGRectMake(0,JX_SCREEN_HEIGHT>812?44:20,44, 44);
  46. [backBtn setImage:[UIImage imageNamed:@"photo_title_back_black"] forState:0];
  47. backBtn.tag = 1001;
  48. [backBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
  49. [navView addSubview:backBtn];
  50. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(50,(JX_SCREEN_HEIGHT>812?44:20), JX_SCREEN_WIDTH-100, 44)];
  51. label.text = title;
  52. if ([image isEqualToString:@"1000"]) {
  53. label.textColor = [UIColor whiteColor];
  54. navView.backgroundColor = [UIColor clearColor];
  55. }else{
  56. label.textColor = kRGBColor51;
  57. navView.backgroundColor = [UIColor whiteColor];
  58. }
  59. label.font = [UIFont systemFontOfSize:18 weight:UIFontWeightRegular];
  60. label.textAlignment = NSTextAlignmentCenter;
  61. [navView addSubview:label];
  62. if ([image isEqualToString:@"222"]) {
  63. }else if ([image isEqualToString:@"zhuanpan"]) {
  64. }else{
  65. UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  66. rightBtn.frame = CGRectMake(JX_SCREEN_WIDTH-64,(JX_SCREEN_HEIGHT>812?44:20), 51, 30);
  67. [rightBtn setTitle:image forState:UIControlStateNormal];
  68. rightBtn.layer.cornerRadius=5;
  69. rightBtn.layer.masksToBounds=YES;
  70. rightBtn.backgroundColor=[UIColor redColor];
  71. rightBtn.tag =1002;
  72. //[rightBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
  73. [navView addSubview:rightBtn];
  74. self.rightBtn=rightBtn;
  75. }
  76. }
  77. - (void)defineNavBar:(NSString *)title andRinghtBtnImg:(NSString *)image
  78. {
  79. UIView *navView = [[UIView alloc] init];
  80. [self.view addSubview:navView];
  81. navView.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH,JX_SCREEN_TOP);
  82. UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  83. backBtn.frame = CGRectMake(0,JX_SCREEN_HEIGHT>812?44:20,44, 44);
  84. [backBtn setImage:[UIImage imageNamed:@"photo_title_back_black"] forState:0];
  85. backBtn.tag = 1001;
  86. [backBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
  87. [navView addSubview:backBtn];
  88. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(50,(JX_SCREEN_HEIGHT>812?44:20), JX_SCREEN_WIDTH-100, 44)];
  89. label.text = title;
  90. if ([image isEqualToString:@"1000"]) {
  91. label.textColor = [UIColor whiteColor];
  92. navView.backgroundColor = [UIColor clearColor];
  93. }else{
  94. label.textColor = kRGBColor51;
  95. navView.backgroundColor = [UIColor whiteColor];
  96. }
  97. label.font = [UIFont systemFontOfSize:18 weight:UIFontWeightRegular];
  98. label.textAlignment = NSTextAlignmentCenter;
  99. [navView addSubview:label];
  100. // UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  101. // rightBtn.frame = CGRectMake(kScreenWidth-44,kTopStateHight, 44, 44);
  102. // [rightBtn setImage:[UIImage imageNamed:@"矢量智能对象"] forState:0];
  103. // rightBtn.tag =1002;
  104. // [rightBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
  105. // [navView addSubview:rightBtn];
  106. }
  107. - (void)click1:(UIButton *)btn{
  108. [self.navigationController popViewControllerAnimated:YES];
  109. }
  110. - (void)click:(UIButton *)btn{
  111. [g_navigation dismissViewController:self animated:YES];
  112. }
  113. @end