Commit 7fb6c827 cgx

修复好眠声音重复bug

1 个父辈 bae627ac
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D062A09D281838B800B4F48A /* FeedbackRequestModel.m */; }; D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D062A09D281838B800B4F48A /* FeedbackRequestModel.m */; };
D062A0A128183FE000B4F48A /* FeedbackDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = D062A0A028183FE000B4F48A /* FeedbackDetailController.m */; }; D062A0A128183FE000B4F48A /* FeedbackDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = D062A0A028183FE000B4F48A /* FeedbackDetailController.m */; };
D070509A28071BAF006D72E1 /* DSNetworkTool.m in Sources */ = {isa = PBXBuildFile; fileRef = D070509928071BAF006D72E1 /* DSNetworkTool.m */; }; D070509A28071BAF006D72E1 /* DSNetworkTool.m in Sources */ = {isa = PBXBuildFile; fileRef = D070509928071BAF006D72E1 /* DSNetworkTool.m */; };
D07257F0286BE5510080F458 /* GoodSleepHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07257EF286BE5510080F458 /* GoodSleepHeadView.m */; };
D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B26280E9BAA00BA0EC0 /* AccountController.m */; }; D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B26280E9BAA00BA0EC0 /* AccountController.m */; };
D07A4B2A280EA6B600BA0EC0 /* UserInfoTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B29280EA6B600BA0EC0 /* UserInfoTableView.m */; }; D07A4B2A280EA6B600BA0EC0 /* UserInfoTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B29280EA6B600BA0EC0 /* UserInfoTableView.m */; };
D07A4B2D280EA73B00BA0EC0 /* UserInfoView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B2C280EA73B00BA0EC0 /* UserInfoView.m */; }; D07A4B2D280EA73B00BA0EC0 /* UserInfoView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B2C280EA73B00BA0EC0 /* UserInfoView.m */; };
...@@ -133,7 +134,6 @@ ...@@ -133,7 +134,6 @@
D09D0E9D280D73B6008DEDAB /* InviteController.m in Sources */ = {isa = PBXBuildFile; fileRef = D09D0E9C280D73B6008DEDAB /* InviteController.m */; }; D09D0E9D280D73B6008DEDAB /* InviteController.m in Sources */ = {isa = PBXBuildFile; fileRef = D09D0E9C280D73B6008DEDAB /* InviteController.m */; };
D0A245F6283DB12100FB49AA /* WKWebView+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A245F5283DB12100FB49AA /* WKWebView+Extras.m */; }; D0A245F6283DB12100FB49AA /* WKWebView+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A245F5283DB12100FB49AA /* WKWebView+Extras.m */; };
D0A72E39282B566200EED7BE /* HomeBasicCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A72E38282B566200EED7BE /* HomeBasicCell.m */; }; D0A72E39282B566200EED7BE /* HomeBasicCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A72E38282B566200EED7BE /* HomeBasicCell.m */; };
D0A72E3C282B56E600EED7BE /* GoodSleepSoundCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A72E3B282B56E600EED7BE /* GoodSleepSoundCell.m */; };
D0A72E3F282B89AD00EED7BE /* DSHomeView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A72E3E282B89AD00EED7BE /* DSHomeView.m */; }; D0A72E3F282B89AD00EED7BE /* DSHomeView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A72E3E282B89AD00EED7BE /* DSHomeView.m */; };
D0A72E42282B8BA600EED7BE /* CourseMusicCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A72E41282B8BA600EED7BE /* CourseMusicCell.m */; }; D0A72E42282B8BA600EED7BE /* CourseMusicCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A72E41282B8BA600EED7BE /* CourseMusicCell.m */; };
D0A750FC282DE21D00589B0E /* NoiseAudioCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A750FB282DE21D00589B0E /* NoiseAudioCell.m */; }; D0A750FC282DE21D00589B0E /* NoiseAudioCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A750FB282DE21D00589B0E /* NoiseAudioCell.m */; };
...@@ -369,6 +369,8 @@ ...@@ -369,6 +369,8 @@
D062A0A028183FE000B4F48A /* FeedbackDetailController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FeedbackDetailController.m; sourceTree = "<group>"; }; D062A0A028183FE000B4F48A /* FeedbackDetailController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FeedbackDetailController.m; sourceTree = "<group>"; };
D070509828071BAF006D72E1 /* DSNetworkTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSNetworkTool.h; sourceTree = "<group>"; }; D070509828071BAF006D72E1 /* DSNetworkTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSNetworkTool.h; sourceTree = "<group>"; };
D070509928071BAF006D72E1 /* DSNetworkTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSNetworkTool.m; sourceTree = "<group>"; }; D070509928071BAF006D72E1 /* DSNetworkTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSNetworkTool.m; sourceTree = "<group>"; };
D07257EE286BE5510080F458 /* GoodSleepHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GoodSleepHeadView.h; sourceTree = "<group>"; };
D07257EF286BE5510080F458 /* GoodSleepHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GoodSleepHeadView.m; sourceTree = "<group>"; };
D07A4B25280E9BAA00BA0EC0 /* AccountController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccountController.h; sourceTree = "<group>"; }; D07A4B25280E9BAA00BA0EC0 /* AccountController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccountController.h; sourceTree = "<group>"; };
D07A4B26280E9BAA00BA0EC0 /* AccountController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AccountController.m; sourceTree = "<group>"; }; D07A4B26280E9BAA00BA0EC0 /* AccountController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AccountController.m; sourceTree = "<group>"; };
D07A4B28280EA6B600BA0EC0 /* UserInfoTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserInfoTableView.h; sourceTree = "<group>"; }; D07A4B28280EA6B600BA0EC0 /* UserInfoTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserInfoTableView.h; sourceTree = "<group>"; };
...@@ -483,8 +485,6 @@ ...@@ -483,8 +485,6 @@
D0A245F5283DB12100FB49AA /* WKWebView+Extras.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "WKWebView+Extras.m"; sourceTree = "<group>"; }; D0A245F5283DB12100FB49AA /* WKWebView+Extras.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "WKWebView+Extras.m"; sourceTree = "<group>"; };
D0A72E37282B566200EED7BE /* HomeBasicCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeBasicCell.h; sourceTree = "<group>"; }; D0A72E37282B566200EED7BE /* HomeBasicCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeBasicCell.h; sourceTree = "<group>"; };
D0A72E38282B566200EED7BE /* HomeBasicCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeBasicCell.m; sourceTree = "<group>"; }; D0A72E38282B566200EED7BE /* HomeBasicCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeBasicCell.m; sourceTree = "<group>"; };
D0A72E3A282B56E600EED7BE /* GoodSleepSoundCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GoodSleepSoundCell.h; sourceTree = "<group>"; };
D0A72E3B282B56E600EED7BE /* GoodSleepSoundCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GoodSleepSoundCell.m; sourceTree = "<group>"; };
D0A72E3D282B89AD00EED7BE /* DSHomeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DSHomeView.h; sourceTree = "<group>"; }; D0A72E3D282B89AD00EED7BE /* DSHomeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DSHomeView.h; sourceTree = "<group>"; };
D0A72E3E282B89AD00EED7BE /* DSHomeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DSHomeView.m; sourceTree = "<group>"; }; D0A72E3E282B89AD00EED7BE /* DSHomeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DSHomeView.m; sourceTree = "<group>"; };
D0A72E40282B8BA600EED7BE /* CourseMusicCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CourseMusicCell.h; sourceTree = "<group>"; }; D0A72E40282B8BA600EED7BE /* CourseMusicCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CourseMusicCell.h; sourceTree = "<group>"; };
...@@ -1532,12 +1532,12 @@ ...@@ -1532,12 +1532,12 @@
D0A72E38282B566200EED7BE /* HomeBasicCell.m */, D0A72E38282B566200EED7BE /* HomeBasicCell.m */,
D0A72E40282B8BA600EED7BE /* CourseMusicCell.h */, D0A72E40282B8BA600EED7BE /* CourseMusicCell.h */,
D0A72E41282B8BA600EED7BE /* CourseMusicCell.m */, D0A72E41282B8BA600EED7BE /* CourseMusicCell.m */,
D0A72E3A282B56E600EED7BE /* GoodSleepSoundCell.h */,
D0A72E3B282B56E600EED7BE /* GoodSleepSoundCell.m */,
D0506B1628054ECD00229278 /* SafeHelperCollectionView.h */, D0506B1628054ECD00229278 /* SafeHelperCollectionView.h */,
D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */, D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */,
D0506B192805500E00229278 /* SafeHelperCollectionViewCell.h */, D0506B192805500E00229278 /* SafeHelperCollectionViewCell.h */,
D0506B1A2805500E00229278 /* SafeHelperCollectionViewCell.m */, D0506B1A2805500E00229278 /* SafeHelperCollectionViewCell.m */,
D07257EE286BE5510080F458 /* GoodSleepHeadView.h */,
D07257EF286BE5510080F458 /* GoodSleepHeadView.m */,
); );
path = View; path = View;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2042,7 +2042,6 @@ ...@@ -2042,7 +2042,6 @@
D07DACAB2810557D0067A1BF /* RSKImageScrollView.m in Sources */, D07DACAB2810557D0067A1BF /* RSKImageScrollView.m in Sources */,
D0AEFE812817DD1500230DC6 /* MyFeedCell.m in Sources */, D0AEFE812817DD1500230DC6 /* MyFeedCell.m in Sources */,
D0F9AC542826563400FD7A3B /* MusicPlayerController.m in Sources */, D0F9AC542826563400FD7A3B /* MusicPlayerController.m in Sources */,
D0A72E3C282B56E600EED7BE /* GoodSleepSoundCell.m in Sources */,
D0506B1528051ED400229278 /* SafeSleepModel.m in Sources */, D0506B1528051ED400229278 /* SafeSleepModel.m in Sources */,
D054CCB52830DE5600420DC4 /* NoisePlayerManager.m in Sources */, D054CCB52830DE5600420DC4 /* NoisePlayerManager.m in Sources */,
D0874BBF2816E61000CECB3C /* RescuePlanView.m in Sources */, D0874BBF2816E61000CECB3C /* RescuePlanView.m in Sources */,
...@@ -2069,6 +2068,7 @@ ...@@ -2069,6 +2068,7 @@
D0D96FDF2848457900461839 /* RelaxTrainRequestModel.m in Sources */, D0D96FDF2848457900461839 /* RelaxTrainRequestModel.m in Sources */,
D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */, D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */,
D030C1B8284775930014946F /* RelaxTrainController.m in Sources */, D030C1B8284775930014946F /* RelaxTrainController.m in Sources */,
D07257F0286BE5510080F458 /* GoodSleepHeadView.m in Sources */,
D049679D2834E1AB00FB81E5 /* ProfileHeaderView.m in Sources */, D049679D2834E1AB00FB81E5 /* ProfileHeaderView.m in Sources */,
D0B1124A28631D8C00A496FB /* DSSlider.m in Sources */, D0B1124A28631D8C00A496FB /* DSSlider.m in Sources */,
D0336163285035AB005573CF /* DailyBgView.m in Sources */, D0336163285035AB005573CF /* DailyBgView.m in Sources */,
......
...@@ -11,12 +11,11 @@ ...@@ -11,12 +11,11 @@
typedef NS_ENUM(NSInteger, CellType) { typedef NS_ENUM(NSInteger, CellType) {
CellTypeCourse, // 舒眠课程 CellTypeCourse, // 舒眠课程
CellTypeMusic, // 助眠音乐 CellTypeMusic, // 助眠音乐
CellTypeGood // 好眠声音
}; };
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/// 舒眠课程、助眠音乐、好眠声音数据通用数据 model /// 舒眠课程、助眠音乐数据通用数据 model
@interface SafeSleepModel : NSObject @interface SafeSleepModel : NSObject
/// cell标题 /// cell标题
@property (nonatomic, copy) NSString *title; @property (nonatomic, copy) NSString *title;
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
@implementation SafeSleepModel @implementation SafeSleepModel
+ (NSArray *)getDatas { + (NSArray *)getDatas {
NSArray *titles = @[@"舒眠课程", @"助眠音乐", @"好眠声音"]; NSArray *titles = @[@"舒眠课程", @"助眠音乐"];
NSArray *types = @[@(CellTypeCourse), @(CellTypeMusic), @(CellTypeGood)]; NSArray *types = @[@(CellTypeCourse), @(CellTypeMusic)];
NSMutableArray *tmpDatas = [NSMutableArray array]; NSMutableArray *tmpDatas = [NSMutableArray array];
for (int i = 0; i < 3; i++) { for (int i = 0; i < titles.count; i++) {
SafeSleepModel *m = [SafeSleepModel new]; SafeSleepModel *m = [SafeSleepModel new];
m.type = [types[i] integerValue]; m.type = [types[i] integerValue];
m.title = titles[i]; m.title = titles[i];
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
#import "DSHomeView.h" #import "DSHomeView.h"
#import "CourseMusicCell.h" #import "CourseMusicCell.h"
#import "GoodSleepSoundCell.h" #import "GoodSleepHeadView.h"
#import "NoiseView.h"
@interface DSHomeView () <UITableViewDelegate, UITableViewDataSource> @interface DSHomeView () <UITableViewDelegate, UITableViewDataSource>
/// 通用数据 /// 通用数据
...@@ -16,14 +17,14 @@ ...@@ -16,14 +17,14 @@
@property (nonatomic, strong) NSArray *courseListArr; @property (nonatomic, strong) NSArray *courseListArr;
/// 助眠音乐数据 /// 助眠音乐数据
@property (nonatomic, strong) NSArray *helpListArr; @property (nonatomic, strong) NSArray *helpListArr;
/// 类型数据 @property (nonatomic, strong) GoodSleepHeadView *goodSleepHeadView;
@property (nonatomic, strong) NSArray *typeArr; @property (nonatomic, strong) NoiseView *noiseView;
@end @end
@implementation DSHomeView @implementation DSHomeView
- (instancetype)init { - (instancetype)init {
if (self = [super initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight(0) - kTabBarHeight) style:UITableViewStylePlain]) { if (self = [super initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight(0) - kTabBarHeight) style:UITableViewStyleGrouped]) {
self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG); self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
self.separatorStyle = UITableViewCellSeparatorStyleNone; self.separatorStyle = UITableViewCellSeparatorStyleNone;
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
self.delegate = self; self.delegate = self;
self.dataSource = self; self.dataSource = self;
self.tableHeaderView = self.headerView; self.tableHeaderView = self.headerView;
self.tableFooterView = self.noiseView;
} }
return self; return self;
} }
...@@ -52,23 +54,13 @@ ...@@ -52,23 +54,13 @@
- (void)updateNoiseAllTypeData:(NSArray *)typeDataArr { - (void)updateNoiseAllTypeData:(NSArray *)typeDataArr {
if (typeDataArr && typeDataArr.count > 0) { if (typeDataArr && typeDataArr.count > 0) {
self.typeArr = typeDataArr; [self.noiseView refreshNoiseTypeData:typeDataArr];
[self reloadData];
} }
} }
#pragma mark - UITableViewDelegate && UITableViewDataSource #pragma mark - UITableViewDelegate && UITableViewDataSource
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath { - (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
NSString *cellID = [NSString stringWithFormat:@"cmg_%zd", indexPath.row]; NSString *cellID = [NSString stringWithFormat:@"CourseMusicCell_%zd", indexPath.row];
if (indexPath.row == 2) {
GoodSleepSoundCell *goodCell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (!goodCell) {
goodCell = [[GoodSleepSoundCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
[goodCell configBasicData:self.courseMusicArr[indexPath.row] cellIndex:indexPath.row];
[goodCell updateNoiseAllTypeData:self.typeArr];
return goodCell;
} else {
CourseMusicCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; CourseMusicCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (!cell) { if (!cell) {
cell = [[CourseMusicCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; cell = [[CourseMusicCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
...@@ -76,7 +68,6 @@ ...@@ -76,7 +68,6 @@
[cell configBasicData:self.courseMusicArr[indexPath.row] cellIndex:indexPath.row]; [cell configBasicData:self.courseMusicArr[indexPath.row] cellIndex:indexPath.row];
[cell updateCourseMusicListWithData:(indexPath.row == 0 ? self.courseListArr : self.helpListArr) cellIndex:indexPath.row]; [cell updateCourseMusicListWithData:(indexPath.row == 0 ? self.courseListArr : self.helpListArr) cellIndex:indexPath.row];
return cell; return cell;
}
} }
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
...@@ -84,15 +75,7 @@ ...@@ -84,15 +75,7 @@
} }
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
CGFloat height = 0; return 228;
if (indexPath.row == 0) {
height = 228;
} else if (indexPath.row == 1) {
height = 228;
} else if (indexPath.row == 2) {
height = 68 + 40 + 327 + 70;
}
return height;
} }
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
...@@ -100,7 +83,7 @@ ...@@ -100,7 +83,7 @@
} }
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0.001; return 68;
} }
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
...@@ -108,16 +91,7 @@ ...@@ -108,16 +91,7 @@
} }
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 0.001)]; return self.goodSleepHeadView;
}
- (NSString *)cellIdentiferAtIndexPath:(NSIndexPath *)indexPath {
SafeSleepModel *item = self.courseMusicArr[indexPath.row];
if (item.type == CellTypeGood) {
return NSStringFromClass([GoodSleepSoundCell class]);
} else {
return NSStringFromClass([CourseMusicCell class]);
}
} }
#pragma mark - lazy #pragma mark - lazy
...@@ -134,6 +108,20 @@ ...@@ -134,6 +108,20 @@
return _headerView; return _headerView;
} }
- (GoodSleepHeadView *)goodSleepHeadView {
if (!_goodSleepHeadView) {
_goodSleepHeadView = [[GoodSleepHeadView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 68)];
}
return _goodSleepHeadView;
}
- (NoiseView *)noiseView {
if (!_noiseView) {
_noiseView = [[NoiseView alloc] initWithNoiseTypeData:@[]];
}
return _noiseView;
}
- (NSArray *)courseMusicArr { - (NSArray *)courseMusicArr {
if (!_courseMusicArr) { if (!_courseMusicArr) {
_courseMusicArr = [SafeSleepModel getDatas]; _courseMusicArr = [SafeSleepModel getDatas];
...@@ -155,11 +143,4 @@ ...@@ -155,11 +143,4 @@
return _helpListArr; return _helpListArr;
} }
- (NSArray *)typeArr {
if (!_typeArr) {
_typeArr = [NSArray array];
}
return _typeArr;
}
@end @end
// //
// GoodSleepSoundCell.h // GoodSleepHeadView.h
// DreamSleep // DreamSleep
// //
// Created by peter on 2022/5/11. // Created by peter on 2022/6/29.
// //
#import "HomeBasicCell.h" #import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/// 好眠声音cell /// 好眠声音头部
@interface GoodSleepSoundCell : HomeBasicCell @interface GoodSleepHeadView : UIView
- (void)updateNoiseAllTypeData:(NSArray *)typeDataArr;
@end @end
......
// //
// GoodSleepSoundCell.m // GoodSleepHeadView.m
// DreamSleep // DreamSleep
// //
// Created by peter on 2022/5/11. // Created by peter on 2022/6/29.
// //
#import "GoodSleepSoundCell.h" #import "GoodSleepHeadView.h"
#import "NoiseListController.h"
#import "NoiseTypeModel.h"
#import "NoiseView.h"
@interface GoodSleepSoundCell () @interface GoodSleepHeadView ()
/// 左边竖条视图
@property (nonatomic, strong) UIView *verticalView;
/// 标题标签
@property (nonatomic, strong) UILabel *titleLab;
/// 定时器
@property (nonatomic, strong) UIButton *timerBtn; @property (nonatomic, strong) UIButton *timerBtn;
@property (nonatomic, strong) NoiseView *noiseView;
@end @end
@implementation GoodSleepSoundCell @implementation GoodSleepHeadView
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { - (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { if (self = [super initWithFrame:frame]) {
[self.contentView addSubview:self.timerBtn]; [self addSubview:self.verticalView];
[self.contentView addSubview:self.noiseView]; [self addSubview:self.titleLab];
[self addSubview:self.timerBtn];
[self.verticalView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.mas_left).offset(15);
make.top.equalTo(self.mas_top).offset(33);
make.width.equalTo(@4);
make.height.equalTo(@16);
}];
[self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.verticalView.mas_right).offset(8);
make.centerY.equalTo(self.verticalView.mas_centerY);
}];
[self.timerBtn mas_makeConstraints:^(MASConstraintMaker *make) { [self.timerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-15); make.right.equalTo(self.mas_right).offset(-15);
make.width.equalTo(@40); make.width.equalTo(@40);
make.height.equalTo(@30); make.height.equalTo(@30);
make.centerY.equalTo(self.verticalView.mas_centerY); make.centerY.equalTo(self.verticalView.mas_centerY);
}]; }];
[self.noiseView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.timerBtn.mas_bottom).offset(5);
make.left.right.bottom.equalTo(self.contentView);
}];
} }
return self; return self;
} }
- (void)updateNoiseAllTypeData:(NSArray *)typeDataArr {
[self.noiseView refreshNoiseTypeData:typeDataArr];
}
#pragma mark - Actions #pragma mark - Actions
- (void)timerSetting:(UIButton *)sender { - (void)timerSetting:(UIButton *)sender {
[[NSNotificationCenter defaultCenter] postNotificationName:NoiseTimingDidClick object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:NoiseTimingDidClick object:nil];
} }
#pragma mark - lazy #pragma mark - lazy
- (UIView *)verticalView {
if (!_verticalView) {
_verticalView = [UIView new];
_verticalView.backgroundColor = BrandColor;
[_verticalView cornerRadius:2.0];
}
return _verticalView;
}
- (UILabel *)titleLab {
if (!_titleLab) {
_titleLab = [UILabel dkLabWithText:@"好眠声音" font:BoldFont(16.0)];
}
return _titleLab;
}
- (UIButton *)timerBtn { - (UIButton *)timerBtn {
if (!_timerBtn) { if (!_timerBtn) {
_timerBtn = [UIButton new]; _timerBtn = [UIButton new];
...@@ -55,11 +75,4 @@ ...@@ -55,11 +75,4 @@
return _timerBtn; return _timerBtn;
} }
- (NoiseView *)noiseView {
if (!_noiseView) {
_noiseView = [[NoiseView alloc] initWithNoiseTypeData:@[]];
}
return _noiseView;
}
@end @end
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
static NSString *mainCell = @"inxx_mainCell"; static NSString *mainCell = @"inxx_mainCell";
- (instancetype)initWithNoiseTypeData:(NSArray *)data { - (instancetype)initWithNoiseTypeData:(NSArray *)data {
if (self = [super init]) { if (self = [super initWithFrame:CGRectMake(0, 0, kScreenWidth, 40 + 327 + 70)]) {
self.pageTypes = data; self.pageTypes = data;
self.controllersClass = @[]; self.controllersClass = @[];
self.selectedIndex = 0; self.selectedIndex = 0;
......
...@@ -7,77 +7,77 @@ ...@@ -7,77 +7,77 @@
<key>AFNetworking.xcscheme_^#shared#^_</key> <key>AFNetworking.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>4</integer> <integer>13</integer>
</dict> </dict>
<key>DKNightVersion.xcscheme_^#shared#^_</key> <key>DKNightVersion.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>10</integer> <integer>11</integer>
</dict> </dict>
<key>DOUAudioStreamer.xcscheme_^#shared#^_</key> <key>DOUAudioStreamer.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>19</integer> <integer>12</integer>
</dict> </dict>
<key>FreeStreamer.xcscheme_^#shared#^_</key> <key>FreeStreamer.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>15</integer> <integer>10</integer>
</dict> </dict>
<key>IQKeyboardManager.xcscheme_^#shared#^_</key> <key>IQKeyboardManager.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>16</integer> <integer>5</integer>
</dict> </dict>
<key>MBProgressHUD.xcscheme_^#shared#^_</key> <key>MBProgressHUD.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>14</integer> <integer>6</integer>
</dict> </dict>
<key>MJRefresh.xcscheme_^#shared#^_</key> <key>MJRefresh.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>17</integer> <integer>18</integer>
</dict> </dict>
<key>Masonry.xcscheme_^#shared#^_</key> <key>Masonry.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>13</integer> <integer>15</integer>
</dict> </dict>
<key>Pods-DreamSleep.xcscheme_^#shared#^_</key> <key>Pods-DreamSleep.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>12</integer> <integer>7</integer>
</dict> </dict>
<key>Reachability.xcscheme_^#shared#^_</key> <key>Reachability.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>7</integer> <integer>14</integer>
</dict> </dict>
<key>YYCache.xcscheme_^#shared#^_</key> <key>YYCache.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>11</integer> <integer>16</integer>
</dict> </dict>
<key>YYImage.xcscheme_^#shared#^_</key> <key>YYImage.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>5</integer> <integer>19</integer>
</dict> </dict>
<key>YYModel.xcscheme_^#shared#^_</key> <key>YYModel.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>8</integer> <integer>17</integer>
</dict> </dict>
<key>YYWebImage.xcscheme_^#shared#^_</key> <key>YYWebImage.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>9</integer> <integer>4</integer>
</dict> </dict>
<key>lottie-ios.xcscheme_^#shared#^_</key> <key>lottie-ios.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>18</integer> <integer>8</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<key>UnityFramework.xcscheme_^#shared#^_</key> <key>UnityFramework.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>6</integer> <integer>9</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!