| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- //
- // MOTeDownloadView.m
- // MiMoLive
- //
- // Created by SuperC on 2025/2/28.
- //
- #import "MOTeDownloadView.h"
- #import "ZJCircleProgressView.h"
- @interface MOTeDownloadView ()
- @property (nonatomic, strong) ZJCircleProgressView *progressView;
- @property (nonatomic, strong) UIImageView *tagIcon;
- @end
- @implementation MOTeDownloadView
- - (instancetype)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
- if(self){
- [self setUIProperty];
- }
- return self;
- }
- - (void)setUIProperty{
-
- self.backgroundColor = [MOTools colorWithHexString:@"#000000" alpha:0.3];
- self.layer.cornerRadius = self.bounds.size.width / 2.0;
- self.layer.masksToBounds = YES;
-
- [self addSubview:self.progressView];
- [self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.height.equalTo(@40.0);
- make.centerX.equalTo(self);
- make.centerY.equalTo(self);
- }];
-
- [self addSubview:self.tagIcon];
- [self.tagIcon mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.height.equalTo(@30.0);
- make.centerX.equalTo(self);
- make.centerY.equalTo(self);
- }];
- // 获取本地文件的路径
- NSString *path = [[NSBundle mainBundle] pathForResource:@"mo_download" ofType:@"gif"];
- NSURL *gifURL = [NSURL fileURLWithPath:path];
-
- // 使用 SDWebImage 加载本地 GIF 动图
- [self.tagIcon sd_setImageWithURL:gifURL placeholderImage:nil options:SDWebImageProgressiveLoad completed:nil];
- }
- - (void)setProgress:(CGFloat)progress{
- _progress = progress;
-
- self.progressView.progress = progress;
- }
- - (ZJCircleProgressView *)progressView{
- if(!_progressView){
- _progressView = [[ZJCircleProgressView alloc] initWithFrame:CGRectMake(0.0, 0.0, 40.0, 40.0)];
- _progressView.lineWidth = 3.0;
- _progressView.trackBackgroundColor = [MOTools colorWithHexString:@"#333333" alpha:0.5];
- _progressView.trackColor = [UIColor whiteColor];
- }
- return _progressView;
- }
- - (UIImageView *)tagIcon{
- if(!_tagIcon){
- _tagIcon = [[UIImageView alloc] init];
- _tagIcon.contentMode = UIViewContentModeScaleAspectFit;
- }
- return _tagIcon;
- }
- @end
|