123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- //
- // 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
|