123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- //
- // PlayerLoadingView.m
- // 隐私保护
- //
- // Created by APPLE on 2023/8/30.
- //
- #import "PlayerLoadingView.h"
- #import "FLAnimatedImageView.h"
- #import "FLAnimatedImage.h"
- #import <Masonry.h>
- @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
|