ReadyItemView.m
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//
// ReadyItemView.m
// DreamSleep
//
// Created by peter on 2022/7/13.
//
#import "ReadyItemView.h"
#import "XLCircleProgress.h"
#import "RingingTools.h"
@interface ReadyItemView ()
@property (nonatomic, strong) XLCircleProgress *circleProgress;
@property (nonatomic, strong) UIImageView *bgIV;
@property (nonatomic, strong) UIButton *enterBtn;
@end
@implementation ReadyItemView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:[UIScreen mainScreen].bounds]) {
self.hidden = YES;
[self addSubview:self.bgIV];
[self addSubview:self.circleProgress];
[self addSubview:self.enterBtn];
[self.bgIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.bottom.equalTo(self).offset(-34);
}];
[self.enterBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(155, 40));
make.centerX.equalTo(self);
make.bottom.equalTo(self).offset(-94-Bottom_SafeArea_Height);
}];
}
return self;
}
- (void)start {
self.hidden = NO;
[RingingTools playRingingWithName:@"sleep_ready_transit"];
[self.circleProgress fire];
}
#pragma mark - lazy
- (XLCircleProgress *)circleProgress {
if (!_circleProgress) {
_circleProgress = [[XLCircleProgress alloc] initWithFrame:CGRectMake(0, 158, 200, 200)];
_circleProgress.centerX = self.centerX;
}
return _circleProgress;
}
- (UIImageView *)bgIV {
if (!_bgIV) {
_bgIV = [UIImageView new];
[_bgIV dk_setImagePicker:DKImagePickerWithNames(@"ai_anshui_xizao", @"dk_ai_anshui_xizao", @"ai_anshui_xizao")];
}
return _bgIV;
}
- (UIButton *)enterBtn {
if (!_enterBtn) {
WS(weakSelf);
_enterBtn = [UIButton btnWithTitle:@"进入下一项" font:BoldFont(16.0)];
[_enterBtn cornerRadius:20.0];
[_enterBtn dk_setBackgroundColorPicker:DKColorPickerWithColors(BrandColor, SubNaviDarkColor, DSWhite)];
[_enterBtn dk_setTitleColorPicker:DKColorPickerWithColors(DSWhite, DkTitleColor, DSWhite) forState:UIControlStateNormal];
[_enterBtn addTouchUpInsideHandler:^(NSInteger tag) {
}];
}
return _enterBtn;
}
@end