// // PlayerLoadingView.m // 隐私保护 // // Created by APPLE on 2023/8/30. // #import "PlayerLoadingView.h" #import "FLAnimatedImageView.h" #import "FLAnimatedImage.h" #import @interface PlayerLoadingView(){ UIView *wattingView; BOOL needSowWattingView; FLAnimatedImageView *wattingViewImageView; UILabel *tipsLabel; } @end @implementation PlayerLoadingView /* // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code } */ - (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; [self drawAnyView]; return self; } - (void)drawAnyView{ [self setBackgroundColor:HW111111Color]; HLog(@"Tan +++++开"); self->wattingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; [self->wattingView setBackgroundColor:RGBACOLOR(0.f, 0.f, 0.f, 0.7)]; [self->wattingView.layer setCornerRadius:10.f]; self->wattingView.hidden = NO; FLAnimatedImage *image = [FLAnimatedImage animatedImageWithGIFData:[NSData dataWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"loadingWhiteGif" withExtension:@"gif"]]]; FLAnimatedImageView *upView = [[FLAnimatedImageView alloc] init]; [upView setFrame:CGRectMake((100 - 65.f)/2.f, (100 - 65.f)/2.f, 65.f, 65.f)]; [upView setContentMode:UIViewContentModeScaleAspectFill]; [upView setBackgroundColor:[ UIColor clearColor]]; upView.animatedImage = image; [self->wattingView addSubview:upView]; [self addSubview:self->wattingView]; [self->wattingView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.mas_centerX); make.top.mas_equalTo(239.f*HAUTOSCALE); make.width.mas_equalTo(100.f); make.height.mas_equalTo(100.f); }]; /*文字*/ tipsLabel = [[UILabel alloc] init]; [tipsLabel setTextColor:HWCFD1D4Color]; [tipsLabel setTextAlignment:(NSTextAlignmentCenter)]; [tipsLabel setFont:[UIFont systemFontOfSize:14.f]]; [self addSubview:tipsLabel]; [tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(20.f); make.top.equalTo(wattingView.mas_bottom).offset(50); make.right.mas_equalTo(-20.f); }]; /*重试按钮*/ UIButton *reTryBtn = [[UIButton alloc] init]; reTryBtn.frame = CGRectMake(0, 0, 126.f, 35.f); // gradient CAGradientLayer *gl = [CAGradientLayer layer]; gl.frame = CGRectMake(0,0,126.f,35.f); 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)]; [reTryBtn.layer addSublayer:gl]; [reTryBtn addTarget:self action:@selector(reTryBtnClick) forControlEvents:(UIControlEventTouchUpInside)]; [reTryBtn setTitle:NSLocalizedString(@"player_retry",nil) forState:(UIControlStateNormal)]; [reTryBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; [reTryBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]]; [reTryBtn.layer setCornerRadius:8.f]; reTryBtn.clipsToBounds = YES; [self addSubview:reTryBtn]; [reTryBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.mas_centerX); make.width.mas_equalTo(126.f); make.top.equalTo(tipsLabel.mas_bottom).offset(54.f); make.height.mas_equalTo(35.f); }]; /*残忍拒绝*/ UIButton *otherBtn = [[UIButton alloc] init]; [otherBtn addTarget:self action:@selector(otherBtnClick) forControlEvents:(UIControlEventTouchUpInside)]; [otherBtn setTitle:NSLocalizedString(@"player_see_other",nil) forState:(UIControlStateNormal)]; [otherBtn setTitleColor:HW999999Color forState:(UIControlStateNormal)]; [otherBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]]; [otherBtn.layer setCornerRadius:8.f]; [otherBtn setBackgroundColor:HWE3E8F1Color]; otherBtn.clipsToBounds = YES; [self addSubview:otherBtn]; [otherBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.mas_centerX); make.width.mas_equalTo(126.f); make.top.equalTo(reTryBtn.mas_bottom).offset(16.f); make.height.mas_equalTo(35.f); }]; } - (void)reTryBtnClick{ ; } - (void)otherBtnClick{ ; } @end