You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
178 lines
6.4 KiB
178 lines
6.4 KiB
![]()
2 years ago
|
//
|
||
|
// transferPopView.m
|
||
|
// Lookfit
|
||
|
//
|
||
|
// Created by ecell on 2023/3/15.
|
||
|
// Copyright © 2023 Sheldon. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "transferPopView.h"
|
||
|
#import "JL_RunSDK.h"
|
||
|
|
||
|
@interface transferPopView ()<UIGestureRecognizerDelegate>
|
||
|
|
||
|
@property (nonatomic ,weak) UIView *bgView;
|
||
|
|
||
|
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation transferPopView
|
||
|
|
||
|
- (instancetype)initWithFrame:(CGRect)frame
|
||
|
{
|
||
|
self = [super initWithFrame:frame];
|
||
|
if (self)
|
||
|
{
|
||
|
self.frame = [UIScreen mainScreen].bounds;
|
||
|
self.backgroundColor = [UIColor colorWithRed:0/255 green:0/255 blue:0/255 alpha:0.5];
|
||
|
}
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
- (void)subPopView
|
||
|
{
|
||
|
UIView *bgView = [UIView new];
|
||
|
bgView.backgroundColor = [UIColor whiteColor];
|
||
|
bgView.frame = CGRectMake(self.centerX-(SCREEN_WIDTH-30)/2, self.centerY-150, SCREEN_WIDTH-30, 300);
|
||
|
bgView.layer.cornerRadius = 3;
|
||
|
bgView.layer.masksToBounds = YES;
|
||
|
self.bgView = bgView;
|
||
|
[self addSubview:bgView];
|
||
|
|
||
|
UILabel *titleLabel = [UILabel new];
|
||
|
titleLabel.text = NSLocalizedString(@"音乐传输", nil);
|
||
|
titleLabel.textColor = [UIColor colorWithRed:81.0/255.0 green:81.0/255.0 blue:81.0/255.0 alpha:1];
|
||
|
titleLabel.textAlignment = NSTextAlignmentCenter;
|
||
|
titleLabel.frame = CGRectMake(0, 15, SCREEN_WIDTH-30, 20);
|
||
|
titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size: 20];
|
||
|
[bgView addSubview:titleLabel];
|
||
|
|
||
|
UILabel *titleLabel1 = [UILabel new];
|
||
|
titleLabel1.text = NSLocalizedString(@"列队进度:", nil);
|
||
|
titleLabel1.textColor = [UIColor colorWithRed:81.0/255.0 green:81.0/255.0 blue:81.0/255.0 alpha:1];
|
||
|
titleLabel1.textAlignment = NSTextAlignmentLeft;
|
||
|
titleLabel1.frame = CGRectMake(15, titleLabel.bottom+20, 80, 20);
|
||
|
titleLabel1.font = [UIFont fontWithName:@"HelveticaNeue" size: 16];
|
||
|
[bgView addSubview:titleLabel1];
|
||
|
|
||
|
UILabel *numberLabel = [UILabel new];
|
||
|
numberLabel.text = NSLocalizedString(@"音乐传输", nil);
|
||
|
numberLabel.textColor = [UIColor colorWithRed:18.0/255.0 green:150.0/255.0 blue:219.0/255.0 alpha:1];
|
||
|
numberLabel.textAlignment = NSTextAlignmentLeft;
|
||
|
numberLabel.frame = CGRectMake(titleLabel1.right+10, titleLabel.bottom+20, 120, 20);
|
||
|
numberLabel.font = [UIFont fontWithName:@"HelveticaNeue" size: 16];
|
||
|
self.numberLabel = numberLabel;
|
||
|
[bgView addSubview:numberLabel];
|
||
|
|
||
|
|
||
|
UILabel *titleLabel2 = [UILabel new];
|
||
|
titleLabel2.text = NSLocalizedString(@"当前任务:", nil);
|
||
|
titleLabel2.textColor = [UIColor colorWithRed:81.0/255.0 green:81.0/255.0 blue:81.0/255.0 alpha:1];
|
||
|
titleLabel2.textAlignment = NSTextAlignmentLeft;
|
||
|
titleLabel2.frame = CGRectMake(15, titleLabel1.bottom+10, 80, 20);
|
||
|
titleLabel2.font = [UIFont fontWithName:@"HelveticaNeue" size: 16];
|
||
|
[bgView addSubview:titleLabel2];
|
||
|
|
||
|
UILabel *titleLabel4 = [UILabel new];
|
||
|
titleLabel4.text = NSLocalizedString(@"音乐传输", nil);
|
||
|
titleLabel4.textColor = [UIColor colorWithRed:18.0/255.0 green:150.0/255.0 blue:219.0/255.0 alpha:1];
|
||
|
titleLabel4.textAlignment = NSTextAlignmentLeft;
|
||
|
titleLabel4.frame = CGRectMake(titleLabel2.right+10, titleLabel1.bottom+10, 80, 20);
|
||
|
titleLabel4.font = [UIFont fontWithName:@"HelveticaNeue" size: 16];
|
||
|
[bgView addSubview:titleLabel4];
|
||
|
|
||
|
UILabel *titleLabel3 = [UILabel new];
|
||
|
titleLabel3.text = NSLocalizedString(@"进度信息:", nil);
|
||
|
titleLabel3.textColor = [UIColor colorWithRed:81.0/255.0 green:81.0/255.0 blue:81.0/255.0 alpha:1];
|
||
|
titleLabel3.textAlignment = NSTextAlignmentLeft;
|
||
|
titleLabel3.frame = CGRectMake(15, titleLabel2.bottom+10, 80, 20);
|
||
|
titleLabel3.font = [UIFont fontWithName:@"HelveticaNeue" size: 16];
|
||
|
[bgView addSubview:titleLabel3];
|
||
|
|
||
|
|
||
|
|
||
|
UILabel *msgLabel = [UILabel new];
|
||
|
//msgLabel.backgroundColor = [UIColor darkGrayColor];
|
||
|
msgLabel.textColor = [UIColor colorWithRed:18.0/255.0 green:150.0/255.0 blue:219.0/255.0 alpha:1];
|
||
|
msgLabel.textAlignment = NSTextAlignmentLeft;
|
||
|
msgLabel.frame = CGRectMake(15, titleLabel3.bottom+10, SCREEN_WIDTH-60, 80);
|
||
|
msgLabel.font = [UIFont fontWithName:@"HelveticaNeue" size: 16];
|
||
|
msgLabel.numberOfLines = 0;
|
||
|
self.msgLabel = msgLabel;
|
||
|
[bgView addSubview:msgLabel];
|
||
|
|
||
|
|
||
|
UIButton *stopBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||
|
stopBtn.backgroundColor = [UIColor colorWithRed:230.0/255.0 green:230.0/255.0 blue:230.0/255.0 alpha:1];
|
||
|
stopBtn.frame = CGRectMake(SCREEN_WIDTH/2-50, 250, 100, 40);
|
||
|
[stopBtn setTitle:@"停止传输" forState:UIControlStateNormal];
|
||
|
stopBtn.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size: 15];
|
||
|
[stopBtn setTitleColor:[UIColor colorWithRed:245.0/255.0 green:124.0/255.0 blue:5.0/255.0 alpha:1] forState:0];
|
||
|
[stopBtn addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
|
||
|
stopBtn.layer.cornerRadius = 5;
|
||
|
stopBtn.layer.masksToBounds = YES;
|
||
|
[bgView addSubview:stopBtn];
|
||
|
|
||
|
|
||
|
[self showPopView];
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
// Only override drawRect: if you perform custom drawing.
|
||
|
// An empty implementation adversely affects performance during animation.
|
||
|
- (void)drawRect:(CGRect)rect {
|
||
|
// Drawing code
|
||
|
}
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
- (void)showPopView
|
||
|
{
|
||
|
[self showWithAlert:self.bgView];
|
||
|
[[UIApplication sharedApplication].delegate.window addSubview:self];;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
添加Alert入场动画
|
||
|
@param alert 添加动画的View
|
||
|
*/
|
||
|
- (void)showWithAlert:(UIView*)alert
|
||
|
{
|
||
|
CAKeyframeAnimation* animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||
|
animation.duration = 0.6;
|
||
|
NSMutableArray *values = [NSMutableArray array];
|
||
|
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1, 0.1, 1.0)]];
|
||
|
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.1, 1.1, 1.0)]];
|
||
|
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]];
|
||
|
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]];
|
||
|
animation.values = values;
|
||
|
[alert.layer addAnimation:animation forKey:nil];
|
||
|
}
|
||
|
|
||
|
- (void)dismiss
|
||
|
{
|
||
|
[JL_RunSDK.sharedInstance stopTransport];
|
||
|
[UIView animateWithDuration:0.6f animations:^{
|
||
|
self.backgroundColor = [UIColor clearColor];
|
||
|
self.alpha = 0;
|
||
|
}completion:^(BOOL finished) {
|
||
|
[self removeFromSuperview];
|
||
|
} ];
|
||
|
}
|
||
|
|
||
|
- (void)handleGuesture:(UITapGestureRecognizer *)sender
|
||
|
{
|
||
|
CGPoint point = [sender locationInView:self.bgView];
|
||
|
if(![self.bgView.layer containsPoint:point])
|
||
|
{
|
||
|
[self dismiss];
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@end
|