TipsQRCodeViewController.m 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. //
  2. // TipsQRCodeViewController.m
  3. // 隐私保护
  4. //
  5. // Created by APPLE on 2023/9/19.
  6. //
  7. #import "TipsQRCodeViewController.h"
  8. #import <Masonry.h>
  9. #import "UIView+View.h"
  10. #import "QRCodeScanViewController.h"
  11. @interface TipsQRCodeViewController ()
  12. @end
  13. @implementation TipsQRCodeViewController
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. // Do any additional setup after loading the view.
  17. [self drawAnyView];
  18. }
  19. - (void)drawAnyView{
  20. [self.navigationBar setHidden:YES];
  21. [self.toolBar setHidden:YES];
  22. [self initBaseUIFun];
  23. /*背景视图*/
  24. // UIImageView *bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"guide_qrcode_bg_icon"]];
  25. // [bgImageView setContentMode:(UIViewContentModeScaleToFill)];
  26. // [self.view addSubview:bgImageView];
  27. // [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  28. // make.top.mas_equalTo(0);
  29. // make.bottom.mas_equalTo(0);
  30. // make.left.mas_equalTo(0);
  31. // make.right.mas_equalTo(0);
  32. // }];
  33. //
  34. // UIButton *qrcodeBtn = [[UIButton alloc] init];
  35. // [qrcodeBtn setBackgroundColor:[UIColor clearColor]];
  36. // [qrcodeBtn setBackgroundImage:[UIImage imageNamed:@"guide_qrcode_icon"] forState:(UIControlStateNormal)];
  37. // [self.view addSubview:qrcodeBtn];
  38. // [qrcodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  39. // make.top.mas_equalTo((363.f/812.f)*self.view.height - 80.f);
  40. // make.centerX.equalTo(self.view.mas_centerX);
  41. // make.width.mas_equalTo(160);
  42. // make.height.mas_equalTo(160);
  43. // }];
  44. //
  45. // [qrcodeBtn addTarget:self
  46. // action:@selector(qrcodeBtnPressed)
  47. // forControlEvents:(UIControlEventTouchUpInside)];
  48. //
  49. // /*提示文字*/
  50. // UILabel *tipsLabel = [[UILabel alloc] init];
  51. // [tipsLabel setFont:[UIFont systemFontOfSize:14]];
  52. // [tipsLabel setTextColor:HW666666Color];
  53. // [tipsLabel setTextAlignment:(NSTextAlignmentCenter)];
  54. // [self.view addSubview:tipsLabel];
  55. // [tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  56. // make.top.equalTo(qrcodeBtn.mas_bottom).offset(8);
  57. // make.left.mas_equalTo(60);
  58. // make.right.mas_equalTo(-60);
  59. // }];
  60. // [tipsLabel setText:NSLocalizedString(@"guide_qrcoede_tips",nil)];
  61. //
  62. // /*扫一扫按钮*/
  63. // UIButton *qrcodeSmallBtn = [[UIButton alloc] init];
  64. // qrcodeSmallBtn.frame = CGRectMake(0, 0, 120.f, 36.f);
  65. //
  66. // // gradient
  67. // CAGradientLayer *gl = [CAGradientLayer layer];
  68. // gl.frame = CGRectMake(0,0,120.f,36.f);
  69. // gl.startPoint = CGPointMake(0, 0.5);
  70. // gl.endPoint = CGPointMake(1, 0.5);
  71. // gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  72. // gl.locations = @[@(0), @(1.0f)];
  73. //
  74. // [qrcodeSmallBtn.layer addSublayer:gl];
  75. // [qrcodeSmallBtn addTarget:self action:@selector(qrcodeBtnPressed) forControlEvents:(UIControlEventTouchUpInside)];
  76. // [qrcodeSmallBtn setTitle:NSLocalizedString(@"guide_qrcoede_btn_title",nil) forState:(UIControlStateNormal)];
  77. // [qrcodeSmallBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  78. // [qrcodeSmallBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
  79. // [qrcodeSmallBtn.layer setCornerRadius:18.f];
  80. // qrcodeSmallBtn.clipsToBounds = YES;
  81. // [self.view addSubview:qrcodeSmallBtn];
  82. // [qrcodeSmallBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  83. // make.centerX.equalTo(self.view.mas_centerX);
  84. // make.width.mas_equalTo(120.f);
  85. // make.top.equalTo(tipsLabel.mas_bottom).offset(20);
  86. // make.height.mas_equalTo(36.f);
  87. // }];
  88. }
  89. - (void)initBaseUIFun
  90. {
  91. self.view.backgroundColor = [UIColor whiteColor];
  92. NSString *curTitleStr = NSLocalizedString(@"scan_Tip_title",nil);
  93. /*标题*/
  94. UILabel *titleLabel = [[UILabel alloc] init];
  95. [titleLabel setFont:[UIFont systemFontOfSize:18]];
  96. [titleLabel setTextColor:HW333333Color];
  97. [titleLabel setTextAlignment:(NSTextAlignmentCenter)];
  98. [self.view addSubview:titleLabel];
  99. [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  100. make.top.equalTo(self.titleLabel.mas_top).offset(0);
  101. make.left.mas_equalTo(10);
  102. make.right.mas_equalTo(-10);
  103. make.height.mas_equalTo(25.0);
  104. }];
  105. [titleLabel setText:curTitleStr];
  106. //
  107. UIScrollView *bgScorllV = [[UIScrollView alloc] init];
  108. bgScorllV.showsHorizontalScrollIndicator = NO;
  109. //bgScorllV.backgroundColor = [UIColor redColor];
  110. [self.view addSubview:bgScorllV];
  111. [bgScorllV mas_makeConstraints:^(MASConstraintMaker *make) {
  112. make.top.equalTo(self.titleLabel.mas_bottom).offset(30);
  113. make.left.mas_equalTo(0);
  114. make.right.mas_equalTo(0);
  115. make.bottom.mas_equalTo(-100.0);
  116. }];
  117. NSString *languageCode = [NSLocale preferredLanguages][0];
  118. NSString *imageNameStr = @"scan_tip_en";
  119. CGFloat imageW = 345.0;
  120. CGFloat imageH = 598.0;
  121. if([languageCode rangeOfString:@"zh-Hans"].location != NSNotFound)
  122. {
  123. imageNameStr = @"scan_tip_Hans";
  124. }
  125. else if([languageCode rangeOfString:@"zh-Hant"].location != NSNotFound)
  126. {
  127. imageNameStr = @"scan_tip_Hant";
  128. }
  129. else if([languageCode rangeOfString:@"ja-"].location != NSNotFound)
  130. {
  131. imageNameStr = @"scan_tip_ja";
  132. imageH = 672.0;
  133. }
  134. UIImageView * bgImageV = [[UIImageView alloc] init];
  135. bgImageV.image = [UIImage imageNamed:imageNameStr];
  136. [bgScorllV addSubview:bgImageV];
  137. [bgImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  138. make.centerX.mas_equalTo(0);
  139. make.top.mas_equalTo(0);
  140. make.width.mas_equalTo(imageW);
  141. make.height.mas_equalTo(imageH);
  142. }];
  143. bgScorllV.contentSize = CGSizeMake(imageW, imageH);
  144. /*扫一扫按钮*/
  145. UIButton *qrcodeSmallBtn = [[UIButton alloc] init];
  146. // gradient
  147. CAGradientLayer *gl = [CAGradientLayer layer];
  148. gl.frame = CGRectMake(0,0,345.f,48.f);
  149. gl.startPoint = CGPointMake(0, 0.5);
  150. gl.endPoint = CGPointMake(1, 0.5);
  151. gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  152. gl.locations = @[@(0), @(1.0f)];
  153. [qrcodeSmallBtn.layer addSublayer:gl];
  154. [qrcodeSmallBtn addTarget:self action:@selector(qrcodeBtnPressed) forControlEvents:(UIControlEventTouchUpInside)];
  155. [qrcodeSmallBtn setTitle:NSLocalizedString(@"scan_Tip_title_button",nil) forState:(UIControlStateNormal)];
  156. [qrcodeSmallBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  157. [qrcodeSmallBtn.titleLabel setFont:[UIFont systemFontOfSize:16.f]];
  158. [qrcodeSmallBtn.layer setCornerRadius:8.f];
  159. qrcodeSmallBtn.clipsToBounds = YES;
  160. [self.view addSubview:qrcodeSmallBtn];
  161. [qrcodeSmallBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  162. make.centerX.equalTo(self.view.mas_centerX);
  163. make.width.mas_equalTo(345.f);
  164. make.top.equalTo(bgScorllV.mas_bottom).offset(15);
  165. make.height.mas_equalTo(48.f);
  166. }];
  167. }
  168. - (void)qrcodeBtnPressed{
  169. QRCodeScanViewController *nextVC = [[QRCodeScanViewController alloc] init];
  170. [self.navigationController pushViewController:nextVC animated:YES];
  171. }
  172. /*
  173. #pragma mark - Navigation
  174. // In a storyboard-based application, you will often want to do a little preparation before navigation
  175. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  176. // Get the new view controller using [segue destinationViewController].
  177. // Pass the selected object to the new view controller.
  178. }
  179. */
  180. @end