TipsQRCodeViewController.m 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. /*背景视图*/
  23. UIImageView *bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"guide_qrcode_bg_icon"]];
  24. [bgImageView setContentMode:(UIViewContentModeScaleToFill)];
  25. [self.view addSubview:bgImageView];
  26. [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.top.mas_equalTo(0);
  28. make.bottom.mas_equalTo(0);
  29. make.left.mas_equalTo(0);
  30. make.right.mas_equalTo(0);
  31. }];
  32. UIButton *qrcodeBtn = [[UIButton alloc] init];
  33. [qrcodeBtn setBackgroundColor:[UIColor clearColor]];
  34. [qrcodeBtn setBackgroundImage:[UIImage imageNamed:@"guide_qrcode_icon"] forState:(UIControlStateNormal)];
  35. [self.view addSubview:qrcodeBtn];
  36. [qrcodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.top.mas_equalTo((363.f/812.f)*self.view.height - 80.f);
  38. make.centerX.equalTo(self.view.mas_centerX);
  39. make.width.mas_equalTo(160);
  40. make.height.mas_equalTo(160);
  41. }];
  42. [qrcodeBtn addTarget:self
  43. action:@selector(qrcodeBtnPressed)
  44. forControlEvents:(UIControlEventTouchUpInside)];
  45. /*提示文字*/
  46. UILabel *tipsLabel = [[UILabel alloc] init];
  47. [tipsLabel setFont:[UIFont systemFontOfSize:14]];
  48. [tipsLabel setTextColor:HW666666Color];
  49. [tipsLabel setTextAlignment:(NSTextAlignmentCenter)];
  50. [self.view addSubview:tipsLabel];
  51. [tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.top.equalTo(qrcodeBtn.mas_bottom).offset(8);
  53. make.left.mas_equalTo(60);
  54. make.right.mas_equalTo(-60);
  55. }];
  56. [tipsLabel setText:NSLocalizedString(@"guide_qrcoede_tips",nil)];
  57. /*扫一扫按钮*/
  58. UIButton *qrcodeSmallBtn = [[UIButton alloc] init];
  59. qrcodeSmallBtn.frame = CGRectMake(0, 0, 120.f, 36.f);
  60. // gradient
  61. CAGradientLayer *gl = [CAGradientLayer layer];
  62. gl.frame = CGRectMake(0,0,120.f,36.f);
  63. gl.startPoint = CGPointMake(0, 0.5);
  64. gl.endPoint = CGPointMake(1, 0.5);
  65. gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  66. gl.locations = @[@(0), @(1.0f)];
  67. [qrcodeSmallBtn.layer addSublayer:gl];
  68. [qrcodeSmallBtn addTarget:self action:@selector(qrcodeBtnPressed) forControlEvents:(UIControlEventTouchUpInside)];
  69. [qrcodeSmallBtn setTitle:NSLocalizedString(@"guide_qrcoede_btn_title",nil) forState:(UIControlStateNormal)];
  70. [qrcodeSmallBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  71. [qrcodeSmallBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
  72. [qrcodeSmallBtn.layer setCornerRadius:18.f];
  73. qrcodeSmallBtn.clipsToBounds = YES;
  74. [self.view addSubview:qrcodeSmallBtn];
  75. [qrcodeSmallBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  76. make.centerX.equalTo(self.view.mas_centerX);
  77. make.width.mas_equalTo(120.f);
  78. make.top.equalTo(tipsLabel.mas_bottom).offset(20);
  79. make.height.mas_equalTo(36.f);
  80. }];
  81. }
  82. - (void)qrcodeBtnPressed{
  83. QRCodeScanViewController *nextVC = [[QRCodeScanViewController alloc] init];
  84. [self.navigationController pushViewController:nextVC animated:YES];
  85. }
  86. /*
  87. #pragma mark - Navigation
  88. // In a storyboard-based application, you will often want to do a little preparation before navigation
  89. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  90. // Get the new view controller using [segue destinationViewController].
  91. // Pass the selected object to the new view controller.
  92. }
  93. */
  94. @end