PlayerLoadingView.m 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //
  2. // PlayerLoadingView.m
  3. // 隐私保护
  4. //
  5. // Created by APPLE on 2023/8/30.
  6. //
  7. #import "PlayerLoadingView.h"
  8. #import "FLAnimatedImageView.h"
  9. #import "FLAnimatedImage.h"
  10. #import <Masonry.h>
  11. @interface PlayerLoadingView(){
  12. UIView *wattingView;
  13. BOOL needSowWattingView;
  14. FLAnimatedImageView *wattingViewImageView;
  15. UILabel *tipsLabel;
  16. }
  17. @end
  18. @implementation PlayerLoadingView
  19. /*
  20. // Only override drawRect: if you perform custom drawing.
  21. // An empty implementation adversely affects performance during animation.
  22. - (void)drawRect:(CGRect)rect {
  23. // Drawing code
  24. }
  25. */
  26. - (id)initWithFrame:(CGRect)frame{
  27. self = [super initWithFrame:frame];
  28. [self drawAnyView];
  29. return self;
  30. }
  31. - (void)drawAnyView{
  32. [self setBackgroundColor:HW111111Color];
  33. HLog(@"Tan +++++开");
  34. self->wattingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
  35. [self->wattingView setBackgroundColor:RGBACOLOR(0.f, 0.f, 0.f, 0.7)];
  36. [self->wattingView.layer setCornerRadius:10.f];
  37. self->wattingView.hidden = NO;
  38. FLAnimatedImage *image = [FLAnimatedImage animatedImageWithGIFData:[NSData dataWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"loadingWhiteGif" withExtension:@"gif"]]];
  39. FLAnimatedImageView *upView = [[FLAnimatedImageView alloc] init];
  40. [upView setFrame:CGRectMake((100 - 65.f)/2.f, (100 - 65.f)/2.f, 65.f, 65.f)];
  41. [upView setContentMode:UIViewContentModeScaleAspectFill];
  42. [upView setBackgroundColor:[ UIColor clearColor]];
  43. upView.animatedImage = image;
  44. [self->wattingView addSubview:upView];
  45. [self addSubview:self->wattingView];
  46. [self->wattingView mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.centerX.equalTo(self.mas_centerX);
  48. make.top.mas_equalTo(239.f*HAUTOSCALE);
  49. make.width.mas_equalTo(100.f);
  50. make.height.mas_equalTo(100.f);
  51. }];
  52. /*文字*/
  53. tipsLabel = [[UILabel alloc] init];
  54. [tipsLabel setTextColor:HWCFD1D4Color];
  55. [tipsLabel setTextAlignment:(NSTextAlignmentCenter)];
  56. [tipsLabel setFont:[UIFont systemFontOfSize:14.f]];
  57. [self addSubview:tipsLabel];
  58. [tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  59. make.left.mas_equalTo(20.f);
  60. make.top.equalTo(wattingView.mas_bottom).offset(50);
  61. make.right.mas_equalTo(-20.f);
  62. }];
  63. /*重试按钮*/
  64. UIButton *reTryBtn = [[UIButton alloc] init];
  65. reTryBtn.frame = CGRectMake(0, 0, 126.f, 35.f);
  66. // gradient
  67. CAGradientLayer *gl = [CAGradientLayer layer];
  68. gl.frame = CGRectMake(0,0,126.f,35.f);
  69. gl.startPoint = CGPointMake(0, 0.5);
  70. gl.endPoint = CGPointMake(1, 0.5);
  71. gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  72. gl.locations = @[@(0), @(1.0f)];
  73. [reTryBtn.layer addSublayer:gl];
  74. [reTryBtn addTarget:self action:@selector(reTryBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
  75. [reTryBtn setTitle:NSLocalizedString(@"player_retry",nil) forState:(UIControlStateNormal)];
  76. [reTryBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  77. [reTryBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
  78. [reTryBtn.layer setCornerRadius:8.f];
  79. reTryBtn.clipsToBounds = YES;
  80. [self addSubview:reTryBtn];
  81. [reTryBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  82. make.centerX.equalTo(self.mas_centerX);
  83. make.width.mas_equalTo(126.f);
  84. make.top.equalTo(tipsLabel.mas_bottom).offset(54.f);
  85. make.height.mas_equalTo(35.f);
  86. }];
  87. /*残忍拒绝*/
  88. UIButton *otherBtn = [[UIButton alloc] init];
  89. [otherBtn addTarget:self action:@selector(otherBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
  90. [otherBtn setTitle:NSLocalizedString(@"player_see_other",nil) forState:(UIControlStateNormal)];
  91. [otherBtn setTitleColor:HW999999Color forState:(UIControlStateNormal)];
  92. [otherBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
  93. [otherBtn.layer setCornerRadius:8.f];
  94. [otherBtn setBackgroundColor:HWE3E8F1Color];
  95. otherBtn.clipsToBounds = YES;
  96. [self addSubview:otherBtn];
  97. [otherBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  98. make.centerX.equalTo(self.mas_centerX);
  99. make.width.mas_equalTo(126.f);
  100. make.top.equalTo(reTryBtn.mas_bottom).offset(16.f);
  101. make.height.mas_equalTo(35.f);
  102. }];
  103. }
  104. - (void)reTryBtnClick{
  105. ;
  106. }
  107. - (void)otherBtnClick{
  108. ;
  109. }
  110. @end