TipsQRCodeViewController.m 8.7 KB

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