TipsQRCodeForChangeDeviceViewController.m 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. //
  2. // TipsQRCodeForChangeDeviceViewController.m
  3. // 隐私保护
  4. //
  5. // Created by APPLE on 2023/9/19.
  6. //
  7. #import "TipsQRCodeForChangeDeviceViewController.h"
  8. #import <Masonry.h>
  9. #import "UIView+View.h"
  10. #import "QRCodeScanForChangeDeviceViewController.h"
  11. @interface TipsQRCodeForChangeDeviceViewController ()
  12. @end
  13. @implementation TipsQRCodeForChangeDeviceViewController
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. // Do any additional setup after loading the view.
  17. [self drawAnyView];
  18. [self.view bringSubviewToFront:self.navBarBGView];
  19. [self.navBarBGView setBackgroundColor:[UIColor clearColor]];
  20. }
  21. - (void)backBtnPressed
  22. {
  23. [super backBtnPressed];
  24. if(_isRootVCType){
  25. //发个通知
  26. [[NSNotificationCenter defaultCenter] postNotificationName:scanChangeDeviceBackNotification object:nil];
  27. }
  28. }
  29. - (void)drawAnyView{
  30. [self.navigationBar setHidden:YES];
  31. [self.toolBar setHidden:YES];
  32. [self.navBarBGView setHidden:NO];
  33. [self.titleLabel setText:NSLocalizedString(@"my_set_no_change_phone",nil)];
  34. /*背景视图*/
  35. UIImageView *bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"guide_qrcode_bg_icon"]];
  36. [bgImageView setContentMode:(UIViewContentModeScaleToFill)];
  37. [self.view addSubview:bgImageView];
  38. [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.top.mas_equalTo(0);
  40. make.bottom.mas_equalTo(0);
  41. make.left.mas_equalTo(0);
  42. make.right.mas_equalTo(0);
  43. }];
  44. UIButton *qrcodeBtn = [[UIButton alloc] init];
  45. [qrcodeBtn setBackgroundColor:[UIColor clearColor]];
  46. [qrcodeBtn setBackgroundImage:[UIImage imageNamed:@"guide_qrcode_icon"] forState:(UIControlStateNormal)];
  47. [self.view addSubview:qrcodeBtn];
  48. [qrcodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.top.mas_equalTo((363.f/812.f)*self.view.height - 80.f);
  50. make.centerX.equalTo(self.view.mas_centerX);
  51. make.width.mas_equalTo(160);
  52. make.height.mas_equalTo(160);
  53. }];
  54. [qrcodeBtn addTarget:self
  55. action:@selector(qrcodeBtnPressed)
  56. forControlEvents:(UIControlEventTouchUpInside)];
  57. /*提示文字*/
  58. UILabel *tipsLabel = [[UILabel alloc] init];
  59. [tipsLabel setFont:[UIFont systemFontOfSize:14]];
  60. [tipsLabel setTextColor:HW666666Color];
  61. [tipsLabel setTextAlignment:(NSTextAlignmentCenter)];
  62. [self.view addSubview:tipsLabel];
  63. [tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.top.equalTo(qrcodeBtn.mas_bottom).offset(8);
  65. make.left.mas_equalTo(60);
  66. make.right.mas_equalTo(-60);
  67. }];
  68. [tipsLabel setText:NSLocalizedString(@"guide_qrcoede_tips",nil)];
  69. /*扫一扫按钮*/
  70. UIButton *qrcodeSmallBtn = [[UIButton alloc] init];
  71. qrcodeSmallBtn.frame = CGRectMake(0, 0, 120.f, 36.f);
  72. // gradient
  73. CAGradientLayer *gl = [CAGradientLayer layer];
  74. gl.frame = CGRectMake(0,0,120.f,36.f);
  75. gl.startPoint = CGPointMake(0, 0.5);
  76. gl.endPoint = CGPointMake(1, 0.5);
  77. gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  78. gl.locations = @[@(0), @(1.0f)];
  79. [qrcodeSmallBtn.layer addSublayer:gl];
  80. [qrcodeSmallBtn addTarget:self action:@selector(qrcodeBtnPressed) forControlEvents:(UIControlEventTouchUpInside)];
  81. [qrcodeSmallBtn setTitle:NSLocalizedString(@"guide_qrcoede_btn_title",nil) forState:(UIControlStateNormal)];
  82. [qrcodeSmallBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  83. [qrcodeSmallBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
  84. [qrcodeSmallBtn.layer setCornerRadius:18.f];
  85. qrcodeSmallBtn.clipsToBounds = YES;
  86. [self.view addSubview:qrcodeSmallBtn];
  87. [qrcodeSmallBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  88. make.centerX.equalTo(self.view.mas_centerX);
  89. make.width.mas_equalTo(120.f);
  90. make.top.equalTo(tipsLabel.mas_bottom).offset(20);
  91. make.height.mas_equalTo(36.f);
  92. }];
  93. }
  94. - (void)qrcodeBtnPressed{
  95. QRCodeScanForChangeDeviceViewController *nextVC = [[QRCodeScanForChangeDeviceViewController alloc] init];
  96. [self.navigationController pushViewController:nextVC animated:YES];
  97. }
  98. /*
  99. #pragma mark - Navigation
  100. // In a storyboard-based application, you will often want to do a little preparation before navigation
  101. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  102. // Get the new view controller using [segue destinationViewController].
  103. // Pass the selected object to the new view controller.
  104. }
  105. */
  106. @end