// // PlayerControlButTipView.m // 隐私保护 // // Created by xd h on 2023/10/12. // #import "PlayerControlButTipView.h" #import "DDYLanguageTool.h" @interface PlayerControlButTipView() @property(nonatomic,strong)UIImageView *ControlButTipLineImageView; @property(nonatomic,strong)UIImageView *ControlImageView; @end @implementation PlayerControlButTipView - (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6]; [self drawAnyView]; return self; } - (void)drawAnyView{ _ControlButTipLineImageView = [[UIImageView alloc] init]; _ControlButTipLineImageView.image = [UIImage imageNamed:@"ControlButTipLine"]; [self addSubview:_ControlButTipLineImageView]; CGFloat curCenterY = SCREEN_H/2.0 + 30; [_ControlButTipLineImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(40.f); make.height.mas_equalTo(56); make.width.mas_equalTo(16.f); make.bottom.mas_equalTo(-curCenterY); }]; _ControlImageView = [[UIImageView alloc] init]; _ControlImageView.image = [UIImage imageNamed:@"you_icon"]; [self addSubview:_ControlImageView]; [_ControlImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(_ControlButTipLineImageView.mas_centerX).offset(0.f); make.height.mas_equalTo(60.f); make.width.mas_equalTo(60.f); make.top.equalTo(_ControlButTipLineImageView.mas_bottom).offset(0.f); }]; /*确认按钮*/ UIButton* okBtn = [[UIButton alloc] init]; CGFloat okBtn_W= 280; // gradient CAGradientLayer *gl = [CAGradientLayer layer]; gl.frame = CGRectMake(0,0,okBtn_W,48); gl.startPoint = CGPointMake(0, 0.5); gl.endPoint = CGPointMake(1, 0.5); gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor]; gl.locations = @[@(0), @(1.0f)]; okBtn.layer.cornerRadius = 24; okBtn.clipsToBounds = YES; [okBtn.layer addSublayer:gl]; [okBtn setTitle:NSLocalizedString(@"player_ControlButton_Tip",nil) forState:(UIControlStateNormal)]; [okBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; NSString* curLanguage = [DDYLanguageTool ddy_AppLanguage]; if(!curLanguage || curLanguage.length == 0){ curLanguage = [DDYLanguageTool ddy_SystemLanguage]; } // "zh-Hant-HK", "zh-Hans-US", if([curLanguage rangeOfString:@"zh-Han"].location != NSNotFound){//中文和繁体 [okBtn.titleLabel setFont:[UIFont systemFontOfSize:16.f]]; } else{//en-US [okBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]]; } [self addSubview:okBtn]; [okBtn mas_makeConstraints:^(MASConstraintMaker *make) { //make.top.equalTo(pwdAgainTextField.mas_bottom).offset(16.f); make.bottom.equalTo(_ControlButTipLineImageView.mas_top).offset(0.f); make.left.mas_equalTo(15.f); make.width.mas_equalTo(okBtn_W); make.height.mas_equalTo(48); }]; [okBtn setEnabled:NO]; /*知道了按钮*/ UIButton* knowBtn = [[UIButton alloc] init]; knowBtn.layer.borderWidth = 1; knowBtn.layer.borderColor = [UIColor whiteColor].CGColor; knowBtn.layer.cornerRadius = 20; knowBtn.clipsToBounds = YES; [knowBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; [knowBtn.titleLabel setFont:[UIFont systemFontOfSize:16.f]]; [knowBtn setTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil) forState:(UIControlStateNormal)]; knowBtn.backgroundColor = [UIColor hwColor:@"ffffff" alpha:0.1]; [self addSubview:knowBtn]; [knowBtn addTarget:self action:@selector(didClickButFun) forControlEvents:(UIControlEventTouchUpInside)]; [knowBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(okBtn.mas_bottom).offset(30.f); make.right.equalTo(okBtn.mas_right).offset(0.f); make.width.mas_equalTo(120.f); make.height.mas_equalTo(40.f); }]; UIButton* nullBtn = [[UIButton alloc] init]; //nullBtn.backgroundColor = [UIColor redColor]; [self addSubview:nullBtn]; [nullBtn addTarget:self action:@selector(didClickNullButFun) forControlEvents:(UIControlEventTouchUpInside)]; [nullBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.mas_equalTo(_ControlImageView.mas_centerY).offset(0.f); make.left.mas_equalTo(0.f); make.width.mas_equalTo(100.f); make.height.mas_equalTo(100.f); }]; } - (void)didClickButFun{ if(_didKnowPlayerControlButTip){ _didKnowPlayerControlButTip(); } [HWDataManager setBoolWithKey:Const_did_Show_playView_controlBtn_Tip value:YES]; [self removeFromSuperview]; } - (void)didClickNullButFun { //HLog(@"4444"); } @end