Commit 85d6674e cgx

开始仪式流程封装

1 个父辈 c9f76e02
正在显示 29 个修改的文件 包含 477 行增加55 行删除
......@@ -57,6 +57,11 @@
D037C49D284F5DE8000F3089 /* TaskPointSrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = D037C49C284F5DE8000F3089 /* TaskPointSrollView.m */; };
D03AE82B281A9010001C0726 /* MyFeedDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D03AE82A281A9010001C0726 /* MyFeedDetailModel.m */; };
D0404A2B2870930A0062AD30 /* BeizerView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0404A2A2870930A0062AD30 /* BeizerView.m */; };
D043A8B3287EB94D00226176 /* sleep_ready_transit.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = D043A8B2287EB94C00226176 /* sleep_ready_transit.mp3 */; };
D043A8B6287EBA4000226176 /* ReadyItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = D043A8B5287EBA4000226176 /* ReadyItemView.m */; };
D043A8B9287EBCA200226176 /* ProgressCircleView.m in Sources */ = {isa = PBXBuildFile; fileRef = D043A8B8287EBCA200226176 /* ProgressCircleView.m */; };
D043A8BC287EC71400226176 /* RingingTools.m in Sources */ = {isa = PBXBuildFile; fileRef = D043A8BB287EC71400226176 /* RingingTools.m */; };
D043A8BF287ECB7100226176 /* StartReadyView.m in Sources */ = {isa = PBXBuildFile; fileRef = D043A8BE287ECB7100226176 /* StartReadyView.m */; };
D043DD55285B11860043A4CE /* VersionUpdateBox.m in Sources */ = {isa = PBXBuildFile; fileRef = D043DD54285B11860043A4CE /* VersionUpdateBox.m */; };
D043DD58285B25EE0043A4CE /* VersionRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D043DD57285B25EE0043A4CE /* VersionRequestModel.m */; };
D0496798283484CC00FB81E5 /* ProfileTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0496797283484CC00FB81E5 /* ProfileTableView.m */; };
......@@ -356,6 +361,15 @@
D03AE82A281A9010001C0726 /* MyFeedDetailModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyFeedDetailModel.m; sourceTree = "<group>"; };
D0404A292870930A0062AD30 /* BeizerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BeizerView.h; sourceTree = "<group>"; };
D0404A2A2870930A0062AD30 /* BeizerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BeizerView.m; sourceTree = "<group>"; };
D043A8B2287EB94C00226176 /* sleep_ready_transit.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = sleep_ready_transit.mp3; sourceTree = "<group>"; };
D043A8B4287EBA4000226176 /* ReadyItemView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReadyItemView.h; sourceTree = "<group>"; };
D043A8B5287EBA4000226176 /* ReadyItemView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReadyItemView.m; sourceTree = "<group>"; };
D043A8B7287EBCA200226176 /* ProgressCircleView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProgressCircleView.h; sourceTree = "<group>"; };
D043A8B8287EBCA200226176 /* ProgressCircleView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProgressCircleView.m; sourceTree = "<group>"; };
D043A8BA287EC71400226176 /* RingingTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RingingTools.h; sourceTree = "<group>"; };
D043A8BB287EC71400226176 /* RingingTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RingingTools.m; sourceTree = "<group>"; };
D043A8BD287ECB7100226176 /* StartReadyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StartReadyView.h; sourceTree = "<group>"; };
D043A8BE287ECB7100226176 /* StartReadyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StartReadyView.m; sourceTree = "<group>"; };
D043DD53285B11860043A4CE /* VersionUpdateBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VersionUpdateBox.h; sourceTree = "<group>"; };
D043DD54285B11860043A4CE /* VersionUpdateBox.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VersionUpdateBox.m; sourceTree = "<group>"; };
D043DD56285B25EE0043A4CE /* VersionRequestModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VersionRequestModel.h; sourceTree = "<group>"; };
......@@ -1026,6 +1040,12 @@
D02D0829287BCEF3005C3A00 /* SRTipsView.m */,
D024CE87287D59FF00FB4320 /* SRMusicView.h */,
D024CE88287D59FF00FB4320 /* SRMusicView.m */,
D043A8BD287ECB7100226176 /* StartReadyView.h */,
D043A8BE287ECB7100226176 /* StartReadyView.m */,
D043A8B4287EBA4000226176 /* ReadyItemView.h */,
D043A8B5287EBA4000226176 /* ReadyItemView.m */,
D043A8B7287EBCA200226176 /* ProgressCircleView.h */,
D043A8B8287EBCA200226176 /* ProgressCircleView.m */,
);
path = SleepReady;
sourceTree = "<group>";
......@@ -1048,6 +1068,7 @@
children = (
D051032D282A4E9200560A0D /* fse.mp3 */,
D051032C282A4E9200560A0D /* instant_eternity.mp3 */,
D043A8B2287EB94C00226176 /* sleep_ready_transit.mp3 */,
D020CE1E280D915D00E7E82F /* invite_friend.webp */,
D0C09ED428007D9100709D4C /* 478_lottie.json */,
D0C09ED528007D9100709D4C /* 478normal_lottie.json */,
......@@ -1456,6 +1477,8 @@
D0C50B4527FD66FB00DC68F0 /* DSConstUtil.m */,
D0B5ECC627F2E97A003EDFE3 /* MacroFuncUtil.h */,
D0B5ECC727F2E97A003EDFE3 /* MacroFuncUtil.m */,
D043A8BA287EC71400226176 /* RingingTools.h */,
D043A8BB287EC71400226176 /* RingingTools.m */,
D0B5ECD627F2F1B0003EDFE3 /* ServerAPIUtil.h */,
D0B5ECD727F2F1B0003EDFE3 /* ServerAPIUtil.m */,
D0B5ECD327F2F0B2003EDFE3 /* AdaptationUtil.h */,
......@@ -2057,6 +2080,7 @@
D020CE1F280D951400E7E82F /* invite_friend.webp in Resources */,
D0F963CD285C51E100D75CD7 /* README.txt in Resources */,
D07F9DE927F4683B0036372F /* DKColorTable.txt in Resources */,
D043A8B3287EB94D00226176 /* sleep_ready_transit.mp3 in Resources */,
D0B5ECB427F2D9E0003EDFE3 /* LaunchScreen.storyboard in Resources */,
D0B5ECB127F2D9E0003EDFE3 /* Assets.xcassets in Resources */,
D04B3DBD27F6F8090022F8DF /* Profile.storyboard in Resources */,
......@@ -2191,6 +2215,7 @@
D0FAC41C281B817D00D4B859 /* GKLoadingView.m in Sources */,
D0BE32E62814D42B006539BE /* HomeRequestModel.m in Sources */,
D0D3826728124E8A005BB219 /* FeedbackController.m in Sources */,
D043A8BF287ECB7100226176 /* StartReadyView.m in Sources */,
D027EE2627FB3DC0004BBA61 /* NetLoadingStateView.m in Sources */,
D01BD42E282C06D200BA86B3 /* NoiseListController.m in Sources */,
D02D082A287BCEF3005C3A00 /* SRTipsView.m in Sources */,
......@@ -2236,10 +2261,12 @@
D003154C284DF46F00CFE94D /* RelaxTrainCell.m in Sources */,
D04B3DAC27F6EEB50022F8DF /* DSTabBarController.m in Sources */,
D0AEFE822817DD1500230DC6 /* MyFeedListController.m in Sources */,
D043A8BC287EC71400226176 /* RingingTools.m in Sources */,
D055BEC828252D8200BC11A4 /* AudioCourseCell.m in Sources */,
D0AEFE7C2817D13400230DC6 /* UITableViewCell+CardRadius.m in Sources */,
D01DC957287023C20035B78B /* RankHeadView.m in Sources */,
D0D5BB0D286D7A8D00D0507E /* TaskGroupModel.m in Sources */,
D043A8B6287EBA4000226176 /* ReadyItemView.m in Sources */,
D09BF331280E570D00E5F06C /* UserModel.m in Sources */,
D0C50B4F27FD832300DC68F0 /* LeadView.m in Sources */,
D091E674283F5B4200D3279E /* ScoreDetailModel.m in Sources */,
......@@ -2266,6 +2293,7 @@
D00A63572824C42300AFFEAA /* DSNetworkCache.m in Sources */,
D0A72E42282B8BA600EED7BE /* CourseMusicCell.m in Sources */,
D0A72E39282B566200EED7BE /* HomeBasicCell.m in Sources */,
D043A8B9287EBCA200226176 /* ProgressCircleView.m in Sources */,
D091E665283F0C4800D3279E /* ScoreTaskRequestModel.m in Sources */,
D08F79DA281A1838000D99DD /* TZPhotoPreviewController.m in Sources */,
D01BD42B282C03FC00BA86B3 /* NoiseAudioModel.m in Sources */,
......
......@@ -18,6 +18,9 @@ FOUNDATION_EXTERN NSString * const IsFirstGuide;
// 首次启动APP进入主页弹框
FOUNDATION_EXTERN NSString * const IsFirstAlert;
// 首次弹睡前准备提示框
FOUNDATION_EXTERN NSString * const IsFirstSRTipsAlert;
// 主题模式自动切换标记
FOUNDATION_EXTERN NSString * const ThemeAutoSwitch;
FOUNDATION_EXTERN NSString * const StartTime1;
......
......@@ -13,6 +13,8 @@ NSString * const FirstShowPrivacy = @"FirstShowPrivacy";
NSString * const IsFirstGuide = @"isFirstGuide";
NSString * const IsFirstAlert = @"isFirstAlert";
NSString * const IsFirstSRTipsAlert = @"isFirstSRTipsAlert";
NSString * const ThemeAutoSwitch = @"themeAutoSwitch";
NSString * const StartTime1 = @"21:00:00";
NSString * const ExpireTime1 = @"23:59:59";
......
#import <Foundation/Foundation.h>
@interface RingingTools : NSObject
+ (void)playRingingWithName:(NSString *)ringName;
+ (void)stopRing;
@end
#import "RingingTools.h"
#import <AVFoundation/AVFoundation.h>
@implementation RingingTools
static AVAudioPlayer const * _player;
+ (void)playRingingWithName:(NSString *)ringName {
NSString *path = [[NSBundle mainBundle] pathForResource:ringName ofType:@"mp3"];
_player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:nil];
[_player prepareToPlay];
[_player play];
}
+ (void)stopRing {
[_player stop];
}
@end
//
// ProgressCircleView.h
// DreamSleep
//
// Created by peter on 2022/7/13.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 安睡准备时间进度表盘
@interface ProgressCircleView : UIView
@end
NS_ASSUME_NONNULL_END
//
// ProgressCircleView.m
// DreamSleep
//
// Created by peter on 2022/7/13.
//
#import "ProgressCircleView.h"
@interface ProgressCircleView ()
@property (nonatomic, strong) UIImageView *dialplateIV;
@end
@implementation ProgressCircleView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self debugViewShowBorder];
self.backgroundColor = DSClearColor;
[self addSubview:self.dialplateIV];
[self.dialplateIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(self);
make.width.height.equalTo(@170);
}];
}
return self;
}
- (void)drawRect:(CGRect)rect {
CGFloat radius = rect.size.height / 2.0;
UIBezierPath *path = [UIBezierPath bezierPath];
path.lineWidth = 2.0;
UIColor *strokeColor = [self.dk_manager.themeVersion isEqualToString:DKThemeVersionNormal] ? ColorFromHex(0xEEEEEE) : ColorFromHex(0x232A40);
[strokeColor setStroke];
[path addArcWithCenter:CGPointMake(radius, radius) radius:radius startAngle:0 endAngle:2*M_PI clockwise:YES];
[path stroke];
}
#pragma mark - lazy
- (UIImageView *)dialplateIV {
if (!_dialplateIV) {
_dialplateIV = [UIImageView new];
[_dialplateIV dk_setImagePicker:DKImagePickerWithNames(@"pic_zhunbei_biaopan", @"dk_pic_zhunbei_biaopan", @"pic_zhunbei_biaopan")];
}
return _dialplateIV;
}
@end
//
// ReadyItemView.h
// DreamSleep
//
// Created by peter on 2022/7/13.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 睡前准备任务视图
@interface ReadyItemView : UIView
- (void)start;
@end
NS_ASSUME_NONNULL_END
//
// ReadyItemView.m
// DreamSleep
//
// Created by peter on 2022/7/13.
//
#import "ReadyItemView.h"
#import "ProgressCircleView.h"
#import "RingingTools.h"
@interface ReadyItemView ()
@property (nonatomic, strong) ProgressCircleView *progressCircleView;
@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.progressCircleView];
[self addSubview:self.enterBtn];
[self.bgIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.bottom.equalTo(self).offset(-34);
}];
[self.progressCircleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.width.height.equalTo(@200);
make.top.equalTo(self).offset(158);
}];
[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"];
}
#pragma mark - lazy
- (ProgressCircleView *)progressCircleView {
if (!_progressCircleView) {
_progressCircleView = [ProgressCircleView new];
}
return _progressCircleView;
}
- (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
......@@ -7,17 +7,19 @@
#import "SleepReadyController.h"
#import "ReadyListController.h"
#import "SRTipsView.h"
#import "SRMusicView.h"
#import "NoisePlayerManager.h"
#import "WhiteNoiseRequestModel.h"
#import "SRTipsView.h"
#import "SRMusicView.h"
#import "StartReadyView.h"
#import "ReadyItemView.h"
@interface SleepReadyController () <ReadyListControllerDelegate>
@property (nonatomic, strong) UIImageView *headIV;
@interface SleepReadyController () <ReadyListControllerDelegate, StartReadyViewDelegate>
@property (nonatomic, strong) UIButton *tipsBtn;
@property (nonatomic, strong) UIButton *setBtn;
@property (nonatomic, strong) SRTipsView *sRTipsView;
@property (nonatomic, strong) UIButton *startBtn;
@property (nonatomic, strong) StartReadyView *startReadyView;
@property (nonatomic, strong) ReadyItemView *readyItemView;
@property (nonatomic, strong) UIButton *musicBtn;
@property (nonatomic, strong) SRMusicView *musicView;
@end
......@@ -27,6 +29,43 @@
- (void)viewDidLoad {
[super viewDidLoad];
[self buildUI];
// 暂停白噪音
[[NSNotificationCenter defaultCenter] postNotificationName:NeedPauseAllNoise object:nil];
// 获取白噪音类型请求
[self queryRelaxWhiteNoiseType];
}
- (void)queryRelaxWhiteNoiseType {
[WhiteNoiseRequestModel queryRelaxWhiteNoiseTypeWithCompletion:^(WhiteNoiseRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
DSLog(@"获取白噪音类型请求成功...");
[self.musicView refreshNoiseTypeData:requestModel.noiseTypeArr];
}
}];
}
- (void)backAction {
// 暂停白噪音
[[NSNotificationCenter defaultCenter] postNotificationName:NeedPauseAllNoise object:nil];
[super backAction];
}
#pragma mark - ReadyListControllerDelegate
#pragma mark - StartReadyViewDelegate
- (void)startTask {
self.tipsBtn.hidden = YES;
self.setBtn.hidden = YES;
self.startReadyView.hidden = YES;
[self.readyItemView start];
self.naviTitle = @"洗澡";
}
#pragma mark - UI
- (void)buildUI {
self.naviTitle = @"睡前准备";
self.naviBarAlpha = 1.0;
self.dsNaviBar.dk_backgroundColorPicker = DKColorPickerWithColors(DSClearColor, DSClearColor, DSWhite);
......@@ -39,8 +78,8 @@
self.view.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self.view insertSubview:self.headIV atIndex:0];
[self.view addSubview:self.startBtn];
[self.view insertSubview:self.startReadyView atIndex:0];
[self.view insertSubview:self.readyItemView atIndex:1];
[self.view addSubview:self.musicBtn];
[self.tipsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
......@@ -51,53 +90,28 @@
make.left.equalTo(self.tipsBtn.mas_right).offset(24);
make.right.equalTo(self.view).offset(-15);
}];
[self.headIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self.view);
}];
[self.startBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(155, 40));
make.centerX.equalTo(self.view);
make.bottom.equalTo(self.view).offset(-94-Bottom_SafeArea_Height);
}];
[self.musicBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.startBtn);
make.right.equalTo(self.view).offset(-15);
make.bottom.equalTo(self.view).offset(-94-Bottom_SafeArea_Height);
}];
// 暂停白噪音
[[NSNotificationCenter defaultCenter] postNotificationName:NeedPauseAllNoise object:nil];
[self queryRelaxWhiteNoiseType];
}
- (void)queryRelaxWhiteNoiseType {
// 获取白噪音类型请求
[WhiteNoiseRequestModel queryRelaxWhiteNoiseTypeWithCompletion:^(WhiteNoiseRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
DSLog(@"获取白噪音类型请求成功...");
[self.musicView refreshNoiseTypeData:requestModel.noiseTypeArr];
}
[self.startReadyView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
[self.readyItemView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
}
- (void)backAction {
// 暂停白噪音
[[NSNotificationCenter defaultCenter] postNotificationName:NeedPauseAllNoise object:nil];
[super backAction];
}
#pragma mark - ReadyListControllerDelegate
#pragma mark - lazy
- (UIImageView *)headIV {
if (!_headIV) {
_headIV = [UIImageView new];
_headIV.dk_imagePicker = DKImagePickerWithNames(@"bg_anshui_start", @"dk_bg_anshui_start", @"bg_anshui_start");
// 首次弹提示框
if (!kGetUserDefaultsBOOL(IsFirstSRTipsAlert)) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.sRTipsView showTipsAlertView];
kSetUserDefaultsBOOL(YES, IsFirstSRTipsAlert);
kUserDefaultsSynchronize;
});
}
return _headIV;
}
#pragma mark - lazy
- (UIButton *)tipsBtn {
if (!_tipsBtn) {
WS(weakSelf);
......@@ -130,16 +144,18 @@
return _sRTipsView;
}
- (UIButton *)startBtn {
if (!_startBtn) {
_startBtn = [UIButton btnWithTitle:@"开始仪式" font:BoldFont(16.0)];
[_startBtn cornerRadius:20.0];
[_startBtn dk_setBackgroundColorPicker:DKColorPickerWithColors(BrandColor, SubNaviDarkColor, DSWhite)];
[_startBtn dk_setTitleColorPicker:DKColorPickerWithColors(DSWhite, DkTitleColor, DSWhite) forState:UIControlStateNormal];
[_startBtn addTouchUpInsideHandler:^(NSInteger tag) {
}];
- (StartReadyView *)startReadyView {
if (!_startReadyView) {
_startReadyView = [[StartReadyView alloc] initWithDelegate:self];
}
return _startReadyView;
}
- (ReadyItemView *)readyItemView {
if (!_readyItemView) {
_readyItemView = [ReadyItemView new];
}
return _startBtn;
return _readyItemView;
}
- (UIButton *)musicBtn {
......
//
// StartReadyView.h
// DreamSleep
//
// Created by peter on 2022/7/13.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol StartReadyViewDelegate <NSObject>
- (void)startTask;
@end
/// 开始准备视图
@interface StartReadyView : UIView
@property (nonatomic, weak) id<StartReadyViewDelegate> delegate;
- (instancetype)initWithDelegate:(id<StartReadyViewDelegate>)delegate;
@end
NS_ASSUME_NONNULL_END
//
// StartReadyView.m
// DreamSleep
//
// Created by peter on 2022/7/13.
//
#import "StartReadyView.h"
@interface StartReadyView ()
@property (nonatomic, strong) UIImageView *headIV;
@property (nonatomic, strong) UIButton *startBtn;
@end
@implementation StartReadyView
- (instancetype)initWithDelegate:(id<StartReadyViewDelegate>)delegate {
if (self = [super initWithFrame:[UIScreen mainScreen].bounds]) {
_delegate = delegate;
[self addSubview:self.headIV];
[self addSubview:self.startBtn];
[self.headIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self);
}];
[self.startBtn 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;
}
#pragma mark - lazy
- (UIImageView *)headIV {
if (!_headIV) {
_headIV = [UIImageView new];
_headIV.dk_imagePicker = DKImagePickerWithNames(@"bg_anshui_start", @"dk_bg_anshui_start", @"bg_anshui_start");
}
return _headIV;
}
- (UIButton *)startBtn {
if (!_startBtn) {
WS(weakSelf);
_startBtn = [UIButton btnWithTitle:@"开始仪式" font:BoldFont(16.0)];
[_startBtn cornerRadius:20.0];
[_startBtn dk_setBackgroundColorPicker:DKColorPickerWithColors(BrandColor, SubNaviDarkColor, DSWhite)];
[_startBtn dk_setTitleColorPicker:DKColorPickerWithColors(DSWhite, DkTitleColor, DSWhite) forState:UIControlStateNormal];
[_startBtn addTouchUpInsideHandler:^(NSInteger tag) {
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(startTask)]) {
[weakSelf.delegate startTask];
}
}];
}
return _startBtn;
}
@end
{
"images" : [
{
"filename" : "ai_anshui_xizao.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ai_anshui_xizao@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ai_anshui_xizao@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "dk_ai_anshui_xizao.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dk_ai_anshui_xizao@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dk_ai_anshui_xizao@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "dk_pic_zhunbei_biaopan.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dk_pic_zhunbei_biaopan@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dk_pic_zhunbei_biaopan@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "pic_zhunbei_biaopan.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "pic_zhunbei_biaopan@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "pic_zhunbei_biaopan@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!