YOUPAILPYoungOpenWindow.m 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //
  2. // YOUPAILPYoungOpenWindow.m
  3. // livePro
  4. //
  5. // Created by leo on 2019/12/26.
  6. // Copyright © 2019 caiPro. All rights reserved.
  7. //
  8. #import "YOUPAILPYoungOpenWindow.h"
  9. #import "NSString+YYAdd.h"
  10. #import "YOUPAILPYoungPwdVC.h"
  11. @interface YOUPAILPYoungOpenWindow ()<UIGestureRecognizerDelegate>
  12. @property(nonatomic,assign)CGFloat youpaiplefpadding,youpaipimgVHeight,youpaipimgVWidth,youpaiptitleHeight;
  13. @property(nonatomic,strong)UIImageView *youpaipimgV;
  14. @property(nonatomic,strong)UIButton *youpaipopenBtn;
  15. @property(nonatomic,strong)UILabel *youpaiptitleLab,*youpaipnoticeLab;
  16. @end
  17. @implementation YOUPAILPYoungOpenWindow
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. // [self.view setFrame:CGRectMake(0, 0, _vWith, _vHeight)];
  21. // CAShapeLayer *maskLayer = [CAShapeLayer layer];
  22. // UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.view.bounds cornerRadius:25];
  23. // maskLayer.path = path.CGPath;
  24. // self.view.layer.mask = maskLayer;
  25. // [self.view setBackgroundColor:[UIColor whiteColor]];
  26. _youpaipimgVWidth = self.vWidth;
  27. _youpaipimgVHeight = 257* self.vWidth/640.0;
  28. _youpaiplefpadding = (KScreenWidth-_youpaipimgVWidth)/2.0;
  29. [self.baseView addSubview:self.youpaipimgV];
  30. [self.baseView addSubview:self.youpaiptitleLab];
  31. [self.baseView addSubview:self.youpaipopenBtn];
  32. [self.baseView addSubview:self.youpaipnoticeLab];
  33. NSString *titleStr = @"为呵护未成年人健康成长\n我们已推出青少年模式";
  34. [_youpaiptitleLab setText:titleStr];
  35. CGSize titleSize = [titleStr sizeForFont:LCBoldFont(16) size:CGSizeMake(self.vWidth, 200) mode:NSLineBreakByWordWrapping];
  36. _youpaiptitleHeight = titleSize.height;
  37. [_youpaipnoticeLab setText:@"设置未成年模式>"];
  38. [_youpaipopenBtn setTitle:@"不再提醒" forState:UIControlStateNormal];
  39. [_youpaiptitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.left.equalTo(self.baseView).with.offset(25);
  41. make.right.equalTo(self.baseView).with.offset(-25);
  42. make.top.equalTo(_youpaipimgV.mas_bottom).with.offset(24);
  43. make.height.mas_equalTo(_youpaiptitleHeight);
  44. }];
  45. [_youpaipopenBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.centerX.equalTo(self.baseView);
  47. make.top.equalTo(_youpaiptitleLab.mas_bottom).with.offset(20);
  48. make.size.mas_equalTo(CGSizeMake(240.0f, 48));
  49. }];
  50. [_youpaipopenBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(240.0f, 48) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:1] forState:UIControlStateNormal];
  51. [_youpaipnoticeLab mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.left.equalTo(self.baseView).with.offset(0);
  53. make.right.equalTo(self.baseView).with.offset(0);
  54. make.top.equalTo(_youpaipopenBtn.mas_bottom).with.offset(20);
  55. make.height.mas_equalTo(20);
  56. }];
  57. UIButton *youpaipForgetPasswordBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  58. [youpaipForgetPasswordBtn setImage:[UIImage imageNamed:@"vqu_images_home_tv_desc_n"] forState:UIControlStateNormal];
  59. [youpaipForgetPasswordBtn setTitle:@"进入青少年模式" forState:UIControlStateNormal];
  60. [youpaipForgetPasswordBtn setTitleColor:LZA3AABEColor forState:UIControlStateNormal];
  61. youpaipForgetPasswordBtn.titleLabel.font = LCFont(13.0f);
  62. [youpaipForgetPasswordBtn addTarget:self action:@selector(youpaifsettingPWD) forControlEvents:UIControlEventTouchUpInside];
  63. [youpaipForgetPasswordBtn setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
  64. [self.baseView addSubview:youpaipForgetPasswordBtn];
  65. [youpaipForgetPasswordBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.centerX.equalTo(self.baseView);
  67. make.top.equalTo(_youpaipopenBtn.mas_bottom).offset(16);
  68. make.size.mas_offset(CGSizeMake(108.0f, 18.0f));
  69. }];
  70. // Do any additional setup after loading the view.
  71. }
  72. -(UIImageView *)youpaipimgV
  73. {
  74. if(!_youpaipimgV)
  75. {
  76. _youpaipimgV = [[UIImageView alloc]initWithFrame:CGRectMake((self.vWidth-135)/2, 20, 135, 135)];
  77. [_youpaipimgV setImage:[UIImage imageNamed:@"vqu_images_juvenile_2"]];
  78. }
  79. return _youpaipimgV;
  80. }
  81. -(UILabel *)youpaiptitleLab
  82. {
  83. if(!_youpaiptitleLab)
  84. {
  85. _youpaiptitleLab = [[UILabel alloc]init];
  86. [_youpaiptitleLab setTextColor:LZ273145Color];
  87. [_youpaiptitleLab setFont:LCBoldFont(16)];
  88. _youpaiptitleLab.numberOfLines = 0;
  89. _youpaiptitleLab.lineBreakMode = NSLineBreakByWordWrapping;
  90. [_youpaiptitleLab setTextAlignment:NSTextAlignmentCenter];
  91. }
  92. return _youpaiptitleLab;
  93. }
  94. -(UIButton *)youpaipopenBtn
  95. {
  96. if(!_youpaipopenBtn)
  97. {
  98. _youpaipopenBtn = [[UIButton alloc]init];
  99. [_youpaipopenBtn.titleLabel setFont:LCFont16];
  100. _youpaipopenBtn.layer.cornerRadius = 24;
  101. _youpaipopenBtn.layer.masksToBounds = YES;
  102. [_youpaipopenBtn addTarget:self action:@selector(youpaifcancelWindow) forControlEvents:UIControlEventTouchUpInside];
  103. [_youpaipopenBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  104. }
  105. return _youpaipopenBtn;
  106. }
  107. -(void)youpaifsettingPWD
  108. {
  109. [self dismissViewControllerAnimated:YES completion:^{
  110. if ([self.youpaipdelegate respondsToSelector:@selector(youpaifyoungSettingPwd)]) {
  111. [self.youpaipdelegate youpaifyoungSettingPwd];
  112. }
  113. }];
  114. }
  115. -(void)youpaifcancelWindow
  116. {
  117. [self dismissViewControllerAnimated:YES completion:nil];
  118. }
  119. /*
  120. #pragma mark - Navigation
  121. // In a storyboard-based application, you will often want to do a little preparation before navigation
  122. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  123. // Get the new view controller using [segue destinationViewController].
  124. // Pass the selected object to the new view controller.
  125. }
  126. */
  127. @end