Commit d87d2176 cgx

首页舒眠课程和助眠音乐调整UI

1 个父辈 8b02b87a
...@@ -1282,10 +1282,10 @@ ...@@ -1282,10 +1282,10 @@
D01814EA28002A8200583D4E /* DsMiddleView.m */, D01814EA28002A8200583D4E /* DsMiddleView.m */,
D0A72E3D282B89AD00EED7BE /* DSHomeView.h */, D0A72E3D282B89AD00EED7BE /* DSHomeView.h */,
D0A72E3E282B89AD00EED7BE /* DSHomeView.m */, D0A72E3E282B89AD00EED7BE /* DSHomeView.m */,
D0A72E40282B8BA600EED7BE /* CourseMusicCell.h */,
D0A72E41282B8BA600EED7BE /* CourseMusicCell.m */,
D0A72E37282B566200EED7BE /* HomeBasicCell.h */, D0A72E37282B566200EED7BE /* HomeBasicCell.h */,
D0A72E38282B566200EED7BE /* HomeBasicCell.m */, D0A72E38282B566200EED7BE /* HomeBasicCell.m */,
D0A72E40282B8BA600EED7BE /* CourseMusicCell.h */,
D0A72E41282B8BA600EED7BE /* CourseMusicCell.m */,
D0A72E3A282B56E600EED7BE /* GoodSleepSoundCell.h */, D0A72E3A282B56E600EED7BE /* GoodSleepSoundCell.h */,
D0A72E3B282B56E600EED7BE /* GoodSleepSoundCell.m */, D0A72E3B282B56E600EED7BE /* GoodSleepSoundCell.m */,
D0506B1628054ECD00229278 /* SafeHelperCollectionView.h */, D0506B1628054ECD00229278 /* SafeHelperCollectionView.h */,
......
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
#define DSBlack [UIColor blackColor] #define DSBlack [UIColor blackColor]
// clearColor // clearColor
#define DSClearColor [UIColor clearColor] #define DSClearColor [UIColor clearColor]
/** 主title颜色 */ /** 主title颜色 */
#define MainTextColor ColorFromHex(0x333333) #define MainTextColor ColorFromHex(0x333333)
/** 子title颜色 */ /** 子title颜色 */
...@@ -74,6 +73,8 @@ ...@@ -74,6 +73,8 @@
#define DarkTextColor ColorFromHex(0x6D7282) #define DarkTextColor ColorFromHex(0x6D7282)
// 小文案颜色 // 小文案颜色
#define SmallTextColor ColorFromHex(0xAAAAAA) #define SmallTextColor ColorFromHex(0xAAAAAA)
// 常用黑夜模式标题颜色
#define DkTitleColor ColorFromHex(0xE8E9E9)
/** 突出显示文案颜色 */ /** 突出显示文案颜色 */
#define HighlightColor ColorFromHex(0x1AB69A) #define HighlightColor ColorFromHex(0x1AB69A)
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
if (self = [super initWithFrame:frame]) { if (self = [super initWithFrame:frame]) {
_templeImgView = [UIImageView new]; _templeImgView = [UIImageView new];
_templeImgView.dk_alphaPicker = DKAlphaPickerWithAlphas(1.0, .5, .5); _templeImgView.dk_alphaPicker = DKAlphaPickerWithAlphas(1.0, .5, .5);
[_templeImgView cornerRadius:10.0]; [_templeImgView cornerRadius:12.0];
[self.contentView addSubview:_templeImgView]; [self.contentView addSubview:_templeImgView];
_templeNameLb = [UILabel new]; _templeNameLb = [UILabel new];
......
...@@ -204,7 +204,6 @@ ...@@ -204,7 +204,6 @@
- (DSHomeView *)homeTV { - (DSHomeView *)homeTV {
if (!_homeTV) { if (!_homeTV) {
_homeTV = [[DSHomeView alloc] init]; _homeTV = [[DSHomeView alloc] init];
_homeTV.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
} }
return _homeTV; return _homeTV;
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
make.top.equalTo(self.titleLab.mas_bottom).offset(17); make.top.equalTo(self.titleLab.mas_bottom).offset(17);
make.left.equalTo(self.verticalView); make.left.equalTo(self.verticalView);
make.right.equalTo(self.contentView); make.right.equalTo(self.contentView);
make.bottom.equalTo(self.contentView).offset(0); make.bottom.equalTo(self.contentView);
}]; }];
} }
return self; return self;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
- (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:UITableViewStylePlain]) {
self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG); self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
self.separatorStyle = UITableViewCellSeparatorStyleNone; self.separatorStyle = UITableViewCellSeparatorStyleNone;
self.showsVerticalScrollIndicator = NO; self.showsVerticalScrollIndicator = NO;
self.delegate = self; self.delegate = self;
...@@ -80,11 +81,11 @@ ...@@ -80,11 +81,11 @@
} }
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
CGFloat height = 300; CGFloat height = 0;
if (indexPath.row == 0) { if (indexPath.row == 0) {
height = 206; height = 228;
} else if (indexPath.row == 1) { } else if (indexPath.row == 1) {
height = 206; height = 228;
} else if (indexPath.row == 2) { } else if (indexPath.row == 2) {
height = 68 + 40 + 327 + 70; height = 68 + 40 + 327 + 70;
} }
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
[self.contentView addSubview:self.noiseView]; [self.contentView addSubview:self.noiseView];
[self.timerBtn mas_makeConstraints:^(MASConstraintMaker *make) { [self.timerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-5); make.right.equalTo(self.contentView.mas_right).offset(-15);
make.width.equalTo(@100); 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);
}]; }];
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
[self.contentView addSubview:self.titleLab]; [self.contentView addSubview:self.titleLab];
[self.verticalView mas_makeConstraints:^(MASConstraintMaker *make) { [self.verticalView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(10); make.left.equalTo(self.contentView.mas_left).offset(15);
make.top.equalTo(self.contentView.mas_top).offset(33); make.top.equalTo(self.contentView.mas_top).offset(33);
make.width.equalTo(@4); make.width.equalTo(@4);
make.height.equalTo(@16); make.height.equalTo(@16);
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
self.titleLab.text = model.title; self.titleLab.text = model.title;
[self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.verticalView.mas_right).offset(10); make.left.equalTo(self.verticalView.mas_right).offset(8);
make.centerY.equalTo(self.verticalView.mas_centerY); make.centerY.equalTo(self.verticalView.mas_centerY);
}]; }];
} }
......
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
- (instancetype)initWithCellIndex:(NSInteger)cellIndex { - (instancetype)initWithCellIndex:(NSInteger)cellIndex {
self.cellIndex = cellIndex; self.cellIndex = cellIndex;
self.courseListData = @[]; self.courseListData = @[];
CGFloat width = cellIndex == 0 ? 100 : 90; CGFloat width = 128;
CGFloat height = cellIndex == 0 ? 130 : 120; CGFloat height = 158;
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 10); layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 15);
layout.itemSize = CGSizeMake(width, height); layout.itemSize = CGSizeMake(width, height);
layout.minimumLineSpacing = 12; layout.minimumLineSpacing = 12;
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#import "SafeHelperCollectionViewCell.h" #import "SafeHelperCollectionViewCell.h"
@interface SafeHelperCollectionViewCell () @interface SafeHelperCollectionViewCell ()
// 圆角视图(舒眠课程Cell显示)
@property (nonatomic, strong) UIView *roundedView;
// 主圆角图片 // 主圆角图片
@property (nonatomic, strong) UIImageView *homeIV; @property (nonatomic, strong) UIImageView *homeIV;
// 舒眠课程icon // 舒眠课程icon
...@@ -36,58 +34,41 @@ ...@@ -36,58 +34,41 @@
[self.audioTypeLab sizeToFit]; [self.audioTypeLab sizeToFit];
if (cellIndex == 0) { // 舒眠课程 if (cellIndex == 0) { // 舒眠课程
[self insertSubview:self.roundedView belowSubview:self.homeIV];
[self addSubview:self.courseIcon]; [self addSubview:self.courseIcon];
[self addSubview:self.courseLab]; [self addSubview:self.courseLab];
self.courseLab.text = [NSString stringWithFormat:@"%d", model.count]; self.courseLab.text = [NSString stringWithFormat:@"%d", model.count];
[self.courseLab sizeToFit]; [self.courseLab sizeToFit];
[self.roundedView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self);
make.width.equalTo(@(100 - 2*12));
make.height.equalTo(@20);
make.centerX.equalTo(self.homeIV);
}];
[self.courseIcon mas_makeConstraints:^(MASConstraintMaker *make) { [self.courseIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.homeIV).offset(7); make.left.equalTo(self.homeIV).offset(8);
make.bottom.equalTo(self.homeIV).offset(-3); make.bottom.equalTo(self.homeIV).offset(-8);
}]; }];
[self.courseLab mas_makeConstraints:^(MASConstraintMaker *make) { [self.courseLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.courseIcon.mas_right).offset(2); make.left.equalTo(self.courseIcon.mas_right).offset(6);
make.centerY.equalTo(self.courseIcon); make.centerY.equalTo(self.courseIcon);
}]; }];
} }
CGFloat width = cellIndex == 0 ? 100 : 90; CGFloat width = 128;
CGFloat bottomSpace = cellIndex == 0 ? 0 : -3;
CGFloat topSpacing = cellIndex == 0 ? 4 : 0;
[self.homeIV mas_makeConstraints:^(MASConstraintMaker *make) { [self.homeIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self).offset(topSpacing); make.top.equalTo(self.contentView);
make.left.equalTo(self); make.left.equalTo(self);
make.width.height.equalTo(@(width)); make.width.height.equalTo(@(width));
}]; }];
[self.audioTypeLab mas_makeConstraints:^(MASConstraintMaker *make) { [self.audioTypeLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.homeIV); make.left.equalTo(self.homeIV);
make.bottom.equalTo(self).offset(bottomSpace); make.bottom.equalTo(self.contentView);
}]; }];
} }
#pragma mark - lazy #pragma mark - lazy
- (UIView *)roundedView {
if (!_roundedView) {
_roundedView = [UIView new];
_roundedView.backgroundColor = ColorFromHex(0xECECEC);
_roundedView.layer.cornerRadius = 12;
_roundedView.layer.masksToBounds = YES;
}
return _roundedView;
}
- (UIImageView *)homeIV { - (UIImageView *)homeIV {
if (!_homeIV) { if (!_homeIV) {
_homeIV = [UIImageView new]; _homeIV = [UIImageView new];
_homeIV.contentMode = UIViewContentModeScaleAspectFill; _homeIV.contentMode = UIViewContentModeScaleAspectFill;
[_homeIV cornerRadius:12.0];
_homeIV.dk_alphaPicker = DKAlphaPickerWithAlphas(1.0, .5, .5);
} }
return _homeIV; return _homeIV;
} }
...@@ -96,20 +77,23 @@ ...@@ -96,20 +77,23 @@
if (!_courseIcon) { if (!_courseIcon) {
_courseIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"courseIcon"]]; _courseIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"courseIcon"]];
[_courseIcon sizeToFit]; [_courseIcon sizeToFit];
_courseIcon.dk_alphaPicker = DKAlphaPickerWithAlphas(1.0, .5, .5);
} }
return _courseIcon; return _courseIcon;
} }
- (UILabel *)courseLab { - (UILabel *)courseLab {
if (!_courseLab) { if (!_courseLab) {
_courseLab = [UILabel labWithTextColor:DSWhite font:SysFont(10)]; _courseLab = [UILabel labWithFont:SysFont(12)];
_courseLab.dk_textColorPicker = DKColorPickerWithColors(DSWhite, DkTitleColor, DSWhite);
} }
return _courseLab; return _courseLab;
} }
- (UILabel *)audioTypeLab { - (UILabel *)audioTypeLab {
if (!_audioTypeLab) { if (!_audioTypeLab) {
_audioTypeLab = [UILabel dkLabWithFont:SysFont(15)]; _audioTypeLab = [UILabel labWithFont:SysFont(15)];
_audioTypeLab.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, DkTitleColor, DSWhite);
} }
return _audioTypeLab; return _audioTypeLab;
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!