PlayerControlButTipView.m 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. //
  2. // PlayerControlButTipView.m
  3. // 隐私保护
  4. //
  5. // Created by xd h on 2023/10/12.
  6. //
  7. #import "PlayerControlButTipView.h"
  8. #import "DDYLanguageTool.h"
  9. @interface PlayerControlButTipView()
  10. @property(nonatomic,strong)UIImageView *ControlButTipLineImageView;
  11. @property(nonatomic,strong)UIImageView *ControlImageView;
  12. @end
  13. @implementation PlayerControlButTipView
  14. - (id)initWithFrame:(CGRect)frame{
  15. self = [super initWithFrame:frame];
  16. self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6];
  17. [self drawAnyView];
  18. return self;
  19. }
  20. - (void)drawAnyView{
  21. _ControlButTipLineImageView = [[UIImageView alloc] init];
  22. _ControlButTipLineImageView.image = [UIImage imageNamed:@"ControlButTipLine"];
  23. [self addSubview:_ControlButTipLineImageView];
  24. CGFloat curCenterY = SCREEN_H/2.0 + 30;
  25. [_ControlButTipLineImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  26. make.left.mas_equalTo(40.f);
  27. make.height.mas_equalTo(56);
  28. make.width.mas_equalTo(16.f);
  29. make.bottom.mas_equalTo(-curCenterY);
  30. }];
  31. _ControlImageView = [[UIImageView alloc] init];
  32. _ControlImageView.image = [UIImage imageNamed:@"you_icon"];
  33. [self addSubview:_ControlImageView];
  34. [_ControlImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.centerX.equalTo(_ControlButTipLineImageView.mas_centerX).offset(0.f);
  36. make.height.mas_equalTo(60.f);
  37. make.width.mas_equalTo(60.f);
  38. make.top.equalTo(_ControlButTipLineImageView.mas_bottom).offset(0.f);
  39. }];
  40. /*确认按钮*/
  41. UIButton* okBtn = [[UIButton alloc] init];
  42. CGFloat okBtn_W= 280;
  43. // gradient
  44. CAGradientLayer *gl = [CAGradientLayer layer];
  45. gl.frame = CGRectMake(0,0,okBtn_W,48);
  46. gl.startPoint = CGPointMake(0, 0.5);
  47. gl.endPoint = CGPointMake(1, 0.5);
  48. gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  49. gl.locations = @[@(0), @(1.0f)];
  50. okBtn.layer.cornerRadius = 24;
  51. okBtn.clipsToBounds = YES;
  52. [okBtn.layer addSublayer:gl];
  53. [okBtn setTitle:NSLocalizedString(@"player_ControlButton_Tip",nil) forState:(UIControlStateNormal)];
  54. [okBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  55. NSString* curLanguage = [DDYLanguageTool ddy_AppLanguage];
  56. if(!curLanguage || curLanguage.length == 0){
  57. curLanguage = [DDYLanguageTool ddy_SystemLanguage];
  58. }
  59. // "zh-Hant-HK", "zh-Hans-US",
  60. if([curLanguage rangeOfString:@"zh-Han"].location != NSNotFound){//中文和繁体
  61. [okBtn.titleLabel setFont:[UIFont systemFontOfSize:16.f]];
  62. }
  63. else{//en-US
  64. [okBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
  65. }
  66. [self addSubview:okBtn];
  67. [okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  68. //make.top.equalTo(pwdAgainTextField.mas_bottom).offset(16.f);
  69. make.bottom.equalTo(_ControlButTipLineImageView.mas_top).offset(0.f);
  70. make.left.mas_equalTo(15.f);
  71. make.width.mas_equalTo(okBtn_W);
  72. make.height.mas_equalTo(48);
  73. }];
  74. [okBtn setEnabled:NO];
  75. /*知道了按钮*/
  76. UIButton* knowBtn = [[UIButton alloc] init];
  77. knowBtn.layer.borderWidth = 1;
  78. knowBtn.layer.borderColor = [UIColor whiteColor].CGColor;
  79. knowBtn.layer.cornerRadius = 20;
  80. knowBtn.clipsToBounds = YES;
  81. [knowBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  82. [knowBtn.titleLabel setFont:[UIFont systemFontOfSize:16.f]];
  83. [knowBtn setTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil) forState:(UIControlStateNormal)];
  84. knowBtn.backgroundColor = [UIColor hwColor:@"ffffff" alpha:0.1];
  85. [self addSubview:knowBtn];
  86. [knowBtn addTarget:self
  87. action:@selector(didClickButFun)
  88. forControlEvents:(UIControlEventTouchUpInside)];
  89. [knowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  90. make.top.equalTo(okBtn.mas_bottom).offset(30.f);
  91. make.right.equalTo(okBtn.mas_right).offset(0.f);
  92. make.width.mas_equalTo(120.f);
  93. make.height.mas_equalTo(40.f);
  94. }];
  95. UIButton* nullBtn = [[UIButton alloc] init];
  96. //nullBtn.backgroundColor = [UIColor redColor];
  97. [self addSubview:nullBtn];
  98. [nullBtn addTarget:self
  99. action:@selector(didClickNullButFun)
  100. forControlEvents:(UIControlEventTouchUpInside)];
  101. [nullBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  102. make.centerY.mas_equalTo(_ControlImageView.mas_centerY).offset(0.f);
  103. make.left.mas_equalTo(0.f);
  104. make.width.mas_equalTo(100.f);
  105. make.height.mas_equalTo(100.f);
  106. }];
  107. }
  108. - (void)didClickButFun{
  109. if(_didKnowPlayerControlButTip){
  110. _didKnowPlayerControlButTip();
  111. }
  112. [HWDataManager setBoolWithKey:Const_did_Show_playView_controlBtn_Tip value:YES];
  113. [self removeFromSuperview];
  114. }
  115. - (void)didClickNullButFun
  116. {
  117. //HLog(@"4444");
  118. }
  119. @end