TipsQRCodeViewController.m 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. /*背景视图*/
  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. UIButton *qrcodeBtn = [[UIButton alloc] init];
  34. [qrcodeBtn setBackgroundColor:[UIColor clearColor]];
  35. [qrcodeBtn setBackgroundImage:[UIImage imageNamed:@"guide_qrcode_icon"] forState:(UIControlStateNormal)];
  36. [self.view addSubview:qrcodeBtn];
  37. [qrcodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.top.mas_equalTo((363.f/812.f)*self.view.height - 80.f);
  39. make.centerX.equalTo(self.view.mas_centerX);
  40. make.width.mas_equalTo(160);
  41. make.height.mas_equalTo(160);
  42. }];
  43. [qrcodeBtn addTarget:self
  44. action:@selector(qrcodeBtnPressed)
  45. forControlEvents:(UIControlEventTouchUpInside)];
  46. /*提示文字*/
  47. UILabel *tipsLabel = [[UILabel alloc] init];
  48. [tipsLabel setFont:[UIFont systemFontOfSize:14]];
  49. [tipsLabel setTextColor:HW666666Color];
  50. [tipsLabel setTextAlignment:(NSTextAlignmentCenter)];
  51. [self.view addSubview:tipsLabel];
  52. [tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  53. make.top.equalTo(qrcodeBtn.mas_bottom).offset(8);
  54. make.left.mas_equalTo(60);
  55. make.right.mas_equalTo(-60);
  56. }];
  57. [tipsLabel setText:NSLocalizedString(@"guide_qrcoede_tips",nil)];
  58. /*扫一扫按钮*/
  59. UIButton *qrcodeSmallBtn = [[UIButton alloc] init];
  60. qrcodeSmallBtn.frame = CGRectMake(0, 0, 120.f, 36.f);
  61. // gradient
  62. CAGradientLayer *gl = [CAGradientLayer layer];
  63. gl.frame = CGRectMake(0,0,120.f,36.f);
  64. gl.startPoint = CGPointMake(0, 0.5);
  65. gl.endPoint = CGPointMake(1, 0.5);
  66. gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  67. gl.locations = @[@(0), @(1.0f)];
  68. [qrcodeSmallBtn.layer addSublayer:gl];
  69. [qrcodeSmallBtn addTarget:self action:@selector(qrcodeBtnPressed) forControlEvents:(UIControlEventTouchUpInside)];
  70. [qrcodeSmallBtn setTitle:NSLocalizedString(@"guide_qrcoede_btn_title",nil) forState:(UIControlStateNormal)];
  71. [qrcodeSmallBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  72. [qrcodeSmallBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
  73. [qrcodeSmallBtn.layer setCornerRadius:18.f];
  74. qrcodeSmallBtn.clipsToBounds = YES;
  75. [self.view addSubview:qrcodeSmallBtn];
  76. [qrcodeSmallBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  77. make.centerX.equalTo(self.view.mas_centerX);
  78. make.width.mas_equalTo(120.f);
  79. make.top.equalTo(tipsLabel.mas_bottom).offset(20);
  80. make.height.mas_equalTo(36.f);
  81. }];
  82. }
  83. - (void)qrcodeBtnPressed{
  84. QRCodeScanViewController *nextVC = [[QRCodeScanViewController alloc] init];
  85. [self.navigationController pushViewController:nextVC animated:YES];
  86. }
  87. /*
  88. #pragma mark - Navigation
  89. // In a storyboard-based application, you will often want to do a little preparation before navigation
  90. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  91. // Get the new view controller using [segue destinationViewController].
  92. // Pass the selected object to the new view controller.
  93. }
  94. */
  95. - (void)viewDidAppear:(BOOL)animated
  96. {
  97. [super viewDidAppear:animated];
  98. if(_isNeedToShowAleatType){
  99. [self showAlertFun];
  100. }
  101. }
  102. - (void)showAlertFun
  103. {
  104. NSString *linkErrTip = NSLocalizedString(@"scan_sn_data_error_tip",nil);
  105. ComontAlretViewController *linkFailAlretVC= [[ComontAlretViewController alloc] initWithTiTle:nil
  106. msg:linkErrTip
  107. imageStr:nil
  108. cancelTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil)
  109. okTitle:nil isOkBtnHighlight:NO
  110. didClickOk:^{
  111. } didClickCancel:^{
  112. }];
  113. linkFailAlretVC.modalPresentationStyle = UIModalPresentationCustom;
  114. [self presentViewController:linkFailAlretVC animated:YES completion:^{
  115. linkFailAlretVC.view.superview.backgroundColor = [UIColor clearColor];
  116. }];
  117. }
  118. @end