Commit c6113e58 cgx

梳理任务积分业务逻辑

1 个父辈 2c7d6a1f
此文件类型无法预览
此文件类型无法预览
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = D027EE2827FB51D0004BBA61 /* DSGifHeader.m */; }; D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = D027EE2827FB51D0004BBA61 /* DSGifHeader.m */; };
D027EE3027FB52DA004BBA61 /* UIImage+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D027EE2F27FB52DA004BBA61 /* UIImage+Extras.m */; }; D027EE3027FB52DA004BBA61 /* UIImage+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D027EE2F27FB52DA004BBA61 /* UIImage+Extras.m */; };
D030C1B8284775930014946F /* RelaxTrainController.m in Sources */ = {isa = PBXBuildFile; fileRef = D030C1B7284775930014946F /* RelaxTrainController.m */; }; D030C1B8284775930014946F /* RelaxTrainController.m in Sources */ = {isa = PBXBuildFile; fileRef = D030C1B7284775930014946F /* RelaxTrainController.m */; };
D033616028502B76005573CF /* DailyTaskTV.m in Sources */ = {isa = PBXBuildFile; fileRef = D033615F28502B76005573CF /* DailyTaskTV.m */; };
D0336163285035AB005573CF /* DailyBgView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0336162285035AB005573CF /* DailyBgView.m */; }; D0336163285035AB005573CF /* DailyBgView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0336162285035AB005573CF /* DailyBgView.m */; };
D037C497284F4A22000F3089 /* SignTaskView.m in Sources */ = {isa = PBXBuildFile; fileRef = D037C496284F4A22000F3089 /* SignTaskView.m */; }; D037C497284F4A22000F3089 /* SignTaskView.m in Sources */ = {isa = PBXBuildFile; fileRef = D037C496284F4A22000F3089 /* SignTaskView.m */; };
D037C49A284F4F0D000F3089 /* DailyTaskCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D037C499284F4F0D000F3089 /* DailyTaskCell.m */; }; D037C49A284F4F0D000F3089 /* DailyTaskCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D037C499284F4F0D000F3089 /* DailyTaskCell.m */; };
...@@ -299,8 +298,6 @@ ...@@ -299,8 +298,6 @@
D027EE2F27FB52DA004BBA61 /* UIImage+Extras.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Extras.m"; sourceTree = "<group>"; }; D027EE2F27FB52DA004BBA61 /* UIImage+Extras.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Extras.m"; sourceTree = "<group>"; };
D030C1B6284775930014946F /* RelaxTrainController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RelaxTrainController.h; sourceTree = "<group>"; }; D030C1B6284775930014946F /* RelaxTrainController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RelaxTrainController.h; sourceTree = "<group>"; };
D030C1B7284775930014946F /* RelaxTrainController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RelaxTrainController.m; sourceTree = "<group>"; }; D030C1B7284775930014946F /* RelaxTrainController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RelaxTrainController.m; sourceTree = "<group>"; };
D033615E28502B76005573CF /* DailyTaskTV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DailyTaskTV.h; sourceTree = "<group>"; };
D033615F28502B76005573CF /* DailyTaskTV.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DailyTaskTV.m; sourceTree = "<group>"; };
D0336161285035AB005573CF /* DailyBgView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DailyBgView.h; sourceTree = "<group>"; }; D0336161285035AB005573CF /* DailyBgView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DailyBgView.h; sourceTree = "<group>"; };
D0336162285035AB005573CF /* DailyBgView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DailyBgView.m; sourceTree = "<group>"; }; D0336162285035AB005573CF /* DailyBgView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DailyBgView.m; sourceTree = "<group>"; };
D037C495284F4A22000F3089 /* SignTaskView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SignTaskView.h; sourceTree = "<group>"; }; D037C495284F4A22000F3089 /* SignTaskView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SignTaskView.h; sourceTree = "<group>"; };
...@@ -1093,8 +1090,6 @@ ...@@ -1093,8 +1090,6 @@
D0D4107B2844B8DB00009638 /* DailyTaskController.m */, D0D4107B2844B8DB00009638 /* DailyTaskController.m */,
D0336161285035AB005573CF /* DailyBgView.h */, D0336161285035AB005573CF /* DailyBgView.h */,
D0336162285035AB005573CF /* DailyBgView.m */, D0336162285035AB005573CF /* DailyBgView.m */,
D033615E28502B76005573CF /* DailyTaskTV.h */,
D033615F28502B76005573CF /* DailyTaskTV.m */,
D037C49B284F5DE8000F3089 /* DailyTaskSrollView.h */, D037C49B284F5DE8000F3089 /* DailyTaskSrollView.h */,
D037C49C284F5DE8000F3089 /* DailyTaskSrollView.m */, D037C49C284F5DE8000F3089 /* DailyTaskSrollView.m */,
D0D4107D2844D38400009638 /* RankModel.h */, D0D4107D2844D38400009638 /* RankModel.h */,
...@@ -1972,7 +1967,6 @@ ...@@ -1972,7 +1967,6 @@
D0E65FFB2807A654006562F2 /* NSDictionary+HYBUnicodeReadable.m in Sources */, D0E65FFB2807A654006562F2 /* NSDictionary+HYBUnicodeReadable.m in Sources */,
D0A245F6283DB12100FB49AA /* WKWebView+Extras.m in Sources */, D0A245F6283DB12100FB49AA /* WKWebView+Extras.m in Sources */,
D0E65FFA2807A654006562F2 /* NSArray+HYBUnicodeReadable.m in Sources */, D0E65FFA2807A654006562F2 /* NSArray+HYBUnicodeReadable.m in Sources */,
D033616028502B76005573CF /* DailyTaskTV.m in Sources */,
D08F79DE281A1838000D99DD /* TZPhotoPickerController.m in Sources */, D08F79DE281A1838000D99DD /* TZPhotoPickerController.m in Sources */,
D04B3DC027F6F82D0022F8DF /* ProfileController.m in Sources */, D04B3DC027F6F82D0022F8DF /* ProfileController.m in Sources */,
D01C9D7028168BFC00163567 /* NSDate+Extension.m in Sources */, D01C9D7028168BFC00163567 /* NSDate+Extension.m in Sources */,
...@@ -2288,7 +2282,7 @@ ...@@ -2288,7 +2282,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements; CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 4; CURRENT_PROJECT_VERSION = 5;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 4NDZ6UX8PW; DEVELOPMENT_TEAM = 4NDZ6UX8PW;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
...@@ -2364,7 +2358,7 @@ ...@@ -2364,7 +2358,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/DreamSleep.entitlements; CODE_SIGN_ENTITLEMENTS = DreamSleep/DreamSleep.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4; CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = 4NDZ6UX8PW; DEVELOPMENT_TEAM = 4NDZ6UX8PW;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
...@@ -2500,7 +2494,7 @@ ...@@ -2500,7 +2494,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepBeta.entitlements; CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepBeta.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4; CURRENT_PROJECT_VERSION = 5;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 4NDZ6UX8PW; DEVELOPMENT_TEAM = 4NDZ6UX8PW;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>DreamSleep.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>DreamSleepBeta.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>DreamSleepDev.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
</dict>
</dict>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "B7FD559A-562B-4E26-9933-6F7E1817C3F7"
type = "0"
version = "2.0">
</Bucket>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
UILabel *leftLab = [UILabel dkLabWithText:@"小梦睡眠" font:BoldFont(24.0)]; UILabel *leftLab = [UILabel dkLabWithText:@"小梦睡眠" font:BoldFont(24.0)];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftLab]; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftLab];
/* rightItem /* rightItem */
UIButton *dailyTaskBtn = [UIButton new]; UIButton *dailyTaskBtn = [UIButton new];
[dailyTaskBtn addTarget:self action:@selector(jumpToDailyTaskPage) forControlEvents:UIControlEventTouchUpInside]; [dailyTaskBtn addTarget:self action:@selector(jumpToDailyTaskPage) forControlEvents:UIControlEventTouchUpInside];
[dailyTaskBtn dk_setImage:DKImagePickerWithNames(@"ic_home_meirirw", @"dk_ic_home_meirirw", @"ic_home_meirirw") forState:UIControlStateNormal]; [dailyTaskBtn dk_setImage:DKImagePickerWithNames(@"ic_home_meirirw", @"dk_ic_home_meirirw", @"ic_home_meirirw") forState:UIControlStateNormal];
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self addScaleAnimtaionWithView:dailyTaskBtn]; [self addScaleAnimtaionWithView:dailyTaskBtn];
}); });
*/
[self.view addSubview:self.homeTV]; [self.view addSubview:self.homeTV];
[self.view addSubview:self.noisePlayBar]; [self.view addSubview:self.noisePlayBar];
......
...@@ -12,6 +12,8 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -12,6 +12,8 @@ NS_ASSUME_NONNULL_BEGIN
/// 每日任务、新手任务cell /// 每日任务、新手任务cell
@interface DailyTaskCell : UITableViewCell @interface DailyTaskCell : UITableViewCell
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier indexPath:(NSIndexPath *)indexPath;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -6,14 +6,34 @@ ...@@ -6,14 +6,34 @@
// //
#import "DailyTaskCell.h" #import "DailyTaskCell.h"
#import "SignTaskView.h"
@interface DailyTaskCell ()
@property (nonatomic, strong) SignTaskView *signTaskView;
@end
@implementation DailyTaskCell @implementation DailyTaskCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { - (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier indexPath:(NSIndexPath *)indexPath {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone; self.selectionStyle = UITableViewCellSelectionStyleNone;
if (indexPath.section == 0) {
[self.contentView addSubview:self.signTaskView];
self.backgroundColor = DSClearColor;
} else {
self.dk_backgroundColorPicker = DKColorPickerWithKey(TabBarBG);
}
} }
return self; return self;
} }
#pragma mark - lazy
- (SignTaskView *)signTaskView {
if (!_signTaskView) {
_signTaskView = [[SignTaskView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth - 30, 186)];
}
return _signTaskView;
}
@end @end
...@@ -9,12 +9,17 @@ ...@@ -9,12 +9,17 @@
#import "ScoreTaskRequestModel.h" #import "ScoreTaskRequestModel.h"
#import "DailyTaskSrollView.h" #import "DailyTaskSrollView.h"
#import "DailyBgView.h" #import "DailyBgView.h"
#import "DailyTaskTV.h" #import "DailyTaskCell.h"
@interface DailyTaskController () <UIScrollViewDelegate> @interface DailyTaskController () <UIScrollViewDelegate, UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) DailyTaskSrollView *dtSrollView; @property (nonatomic, strong) DailyTaskSrollView *dtSrollView;
@property (nonatomic, strong) UIScrollView *scrollInnerView;
@property (nonatomic, strong) DailyBgView *dailyBgView; @property (nonatomic, strong) DailyBgView *dailyBgView;
@property (nonatomic, strong) DailyTaskTV *taskTableView; @property (nonatomic, strong) UITableView *taskTableView;
@property (nonatomic, assign) BOOL vccanScroll;
@property (nonatomic, assign) CGFloat bgHeight;
@property (nonatomic, assign) CGFloat coverHeight;
@property (nonatomic, strong) NSMutableArray *taskListArr;
@end @end
@implementation DailyTaskController @implementation DailyTaskController
...@@ -22,14 +27,26 @@ ...@@ -22,14 +27,26 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[self initUI]; self.vccanScroll = YES;
self.bgHeight = kScreenWidth*300/375.0;
self.coverHeight = 50;
// 模拟数据
for (int i = 0; i < 10; i++) {
[self.taskListArr addObject:@(i+1)];
}
self.view.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
self.naviBgColor = DSClearColor;
self.naviBarAlpha = 1.0;
[self.backBtn dk_setImage:DKImagePickerWithNames(@"cus_back_icon", @"sys_back_icon", @"sys_back_icon") forState:UIControlStateNormal];
[self.dsNaviBar addSubview:self.backBtn];
[self.view insertSubview:self.dtSrollView belowSubview:self.dsNaviBar];
[ScoreTaskRequestModel queryUserSignListWithCompletion:^(ScoreTaskRequestModel * _Nonnull requestModel) { [ScoreTaskRequestModel queryUserSignListWithCompletion:^(ScoreTaskRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) { if (requestModel.resCode == DSResCodeSuccess) {
} }
}]; }];
[ScoreTaskRequestModel queryUserDailyTaskListWithCompletion:^(ScoreTaskRequestModel * _Nonnull requestModel) { [ScoreTaskRequestModel queryUserDailyTaskListWithCompletion:^(ScoreTaskRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) { if (requestModel.resCode == DSResCodeSuccess) {
...@@ -37,54 +54,186 @@ ...@@ -37,54 +54,186 @@
}]; }];
} }
- (void)initUI {
self.view.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
self.naviBgColor = DSClearColor;
self.naviBarAlpha = 1.0;
[self.dsNaviBar addSubview:self.backBtn];
[self.view insertSubview:self.dtSrollView belowSubview:self.dsNaviBar];
[self.dtSrollView addSubview:self.dailyBgView];
[self.dtSrollView addSubview:self.taskTableView];
[self.dtSrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
self.dtSrollView.contentSize = CGSizeMake(kScreenWidth, self.dailyBgView.height + self.taskTableView.height - 50);
}
#pragma mark - UIScrollViewDelegate #pragma mark - UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGFloat offsetY = scrollView.contentOffset.y; CGFloat offsetY = scrollView.contentOffset.y;
if (scrollView == self.dtSrollView) { if (scrollView == self.dtSrollView) {
self.dtSrollView.bounces = offsetY <= 0 ? NO : YES; CGFloat maxOffsetY = self.bgHeight - self.coverHeight;
if (offsetY >= maxOffsetY) {
scrollView.contentOffset = CGPointMake(0, maxOffsetY);
self.vccanScroll = NO;
self.naviTitle = @"每日任务";
self.isNeedUpdateStatusBarStyle = YES;
self.dsNaviBar.dk_backgroundColorPicker = DKColorPickerWithColors(BrandColor, SubNaviDarkColor, BrandColor);
[self.backBtn setImage:[UIImage imageNamed:@"sys_back_icon"] forState:UIControlStateNormal];
} else {
if (self.vccanScroll == NO) {
scrollView.contentOffset = CGPointMake(0, maxOffsetY);
}
}
if (offsetY <= 0) {
self.naviTitle = @"";
self.naviBgColor = DSClearColor;
self.isNeedUpdateStatusBarStyle = NO;
[self.backBtn dk_setImage:DKImagePickerWithNames(@"cus_back_icon", @"sys_back_icon", @"sys_back_icon") forState:UIControlStateNormal];
}
} else if (scrollView == self.taskTableView) {
CGPoint point = [scrollView.panGestureRecognizer translationInView:scrollView];
CGFloat taboffsetY = point.y;
if (offsetY < 0) {
self.vccanScroll = YES;
}
if (taboffsetY < 0) {
if (self.dtSrollView.contentOffset.y < self.bgHeight - self.coverHeight) {
self.taskTableView.contentOffset = CGPointZero;
}
} else {
if (offsetY > 0) {
self.dtSrollView.contentOffset = CGPointMake(0, self.bgHeight - self.coverHeight);
} else if (offsetY < 0) {
if (self.dtSrollView.contentOffset.y > 0 && self.dtSrollView.contentOffset.y < self.bgHeight - self.coverHeight) {
self.taskTableView.contentOffset = CGPointZero;
}
}
}
}
}
#pragma mark - UITableViewDelegate && UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 3;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0) {
return 1;
} }
return self.taskListArr.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0) {
return 186;
} else {
return 50;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *cellID = [NSString stringWithFormat:@"DailyTaskCell_%zd", indexPath.section];
DailyTaskCell *signCell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (!signCell) {
signCell = [[DailyTaskCell alloc] initWithReuseIdentifier:cellID indexPath:indexPath];
}
if (indexPath.section == 0) {
} else {
}
return signCell;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
// 最后1个单元格圆角设置
if (indexPath.row == self.taskListArr.count - 1) {
[cell setCornerRadiusRect:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadius:24.0];
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
if (section == 0) {
return 0.001;
} else {
return 15.0 + 52;
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
if (section == 2) {
return (24 + Bottom_SafeArea_Height);
} else {
return 0.001;
}
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
CGFloat h = section == 0 ? 0.001 : 15.0 + 52;
if (section == 0) {
return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, h)];
} else {
// 添加分区头
UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, h)];
headView.backgroundColor = DSClearColor;
UILabel *titleLab = [UILabel labWithText:(section == 1 ? @"每日任务" : @"新手任务") font:BoldFont(16.0) fit:YES];
titleLab.textAlignment = NSTextAlignmentCenter;
titleLab.frame = CGRectMake(0, 15, kScreenWidth - 30, 52);
[titleLab setCornerRadiusRect:(UIRectCornerTopLeft | UIRectCornerTopRight) cornerRadius:24.0];
titleLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
titleLab.dk_backgroundColorPicker = DKColorPickerWithKey(TabBarBG);
[headView addSubview:titleLab];
return headView;
}
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
CGFloat h = section == 2 ? (24 + Bottom_SafeArea_Height) : 0.001;
return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, h)];
} }
#pragma mark - lazy #pragma mark - lazy
- (DailyTaskSrollView *)dtSrollView { - (DailyTaskSrollView *)dtSrollView {
if (!_dtSrollView) { if (!_dtSrollView) {
_dtSrollView = [DailyTaskSrollView new]; _dtSrollView = [[DailyTaskSrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
_dtSrollView.contentSize = CGSizeMake(kScreenWidth, self.bgHeight + kScreenHeight - self.coverHeight);
_dtSrollView.showsVerticalScrollIndicator = NO; _dtSrollView.showsVerticalScrollIndicator = NO;
_dtSrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; _dtSrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
_dtSrollView.delegate = self; _dtSrollView.delegate = self;
_dtSrollView.bounces = NO;
[_dtSrollView addSubview:self.scrollInnerView];
} }
return _dtSrollView; return _dtSrollView;
} }
- (UIScrollView *)scrollInnerView {
if (_scrollInnerView == nil) {
_scrollInnerView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight + self.bgHeight - self.coverHeight)];
_scrollInnerView.contentSize = CGSizeMake(kScreenWidth, kScreenHeight + self.bgHeight - self.coverHeight);
_scrollInnerView.showsVerticalScrollIndicator = NO;
_scrollInnerView.delegate = self;
_scrollInnerView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[_scrollInnerView addSubview:self.dailyBgView];
[_scrollInnerView addSubview:self.taskTableView];
}
return _scrollInnerView;
}
- (DailyBgView *)dailyBgView { - (DailyBgView *)dailyBgView {
if (!_dailyBgView) { if (!_dailyBgView) {
_dailyBgView = [[DailyBgView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenWidth*300/375.0)]; _dailyBgView = [[DailyBgView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, self.bgHeight)];
} }
return _dailyBgView; return _dailyBgView;
} }
- (DailyTaskTV *)taskTableView { - (UITableView *)taskTableView {
if (!_taskTableView) { if (!_taskTableView) {
_taskTableView = [[DailyTaskTV alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(self.dailyBgView.frame) - 50, kScreenWidth - 30, 500) style:UITableViewStyleGrouped]; _taskTableView = [[UITableView alloc] initWithFrame:CGRectMake(15, self.bgHeight - self.coverHeight, kScreenWidth - 30, kScreenHeight) style:UITableViewStyleGrouped];
_taskTableView.delegate = self;
_taskTableView.dataSource = self;
_taskTableView.backgroundColor = DSClearColor;
_taskTableView.showsVerticalScrollIndicator = NO;
_taskTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
} }
return _taskTableView; return _taskTableView;
} }
- (NSMutableArray *)taskListArr {
if (!_taskListArr) {
_taskListArr = [NSMutableArray array];
}
return _taskListArr;
}
@end @end
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
@implementation DailyTaskSrollView @implementation DailyTaskSrollView
//- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecogn { //返回YES,则可以多个手势一起触发方法,返回NO则为互斥(比如外层UIScrollView名为mainScroll内嵌的UIScrollView名为subScroll,当我们拖动subScroll时,mainScroll是不会响应手势的(多个手势默认是互斥的),当下面这个代理返回YES时,subScroll和mainScroll就能同时响应手势,同时滚动,这符合我们这里的需求)
// return YES; - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
//} return YES;
}
@end @end
//
// DailyTaskTV.h
// DreamSleep
//
// Created by peter on 2022/6/8.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface DailyTaskTV : UITableView
@end
NS_ASSUME_NONNULL_END
//
// DailyTaskTV.m
// DreamSleep
//
// Created by peter on 2022/6/8.
//
#import "DailyTaskTV.h"
#import "DailyTaskCell.h"
#import "SignTaskView.h"
@interface DailyTaskTV () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) SignTaskView *signTaskView;
@end
@implementation DailyTaskTV
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
if (self = [super initWithFrame:frame style:style]) {
// self.scrollEnabled = NO;
self.backgroundColor = DSClearColor;
[self debugViewShowBorderWithColor:DSBlack];
self.delegate = self;
self.dataSource = self;
self.tableHeaderView = self.signTaskView;
self.rowHeight = 50;
self.showsVerticalScrollIndicator = NO;
self.separatorStyle = UITableViewCellSeparatorStyleNone;
[self registerClass:[DailyTaskCell class] forCellReuseIdentifier:NSStringFromClass([DailyTaskCell class])];
self.height = self.signTaskView.height + 20*50 + 30;
}
return self;
}
#pragma mark - UITableViewDelegate && UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
DailyTaskCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([DailyTaskCell class]) forIndexPath:indexPath];
cell.textLabel.text = [NSString stringWithFormat:@"%ld", indexPath.row + 1];
return cell;
}
//- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecogn {
// return YES;
//}
- (SignTaskView *)signTaskView {
if (!_signTaskView) {
_signTaskView = [[SignTaskView alloc] initWithFrame:CGRectMake(15, 0, kScreenWidth - 30, 186)];
}
return _signTaskView;
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>AFNetworking.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
</dict>
<key>DKNightVersion.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>10</integer>
</dict>
<key>DOUAudioStreamer.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>19</integer>
</dict>
<key>FreeStreamer.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>15</integer>
</dict>
<key>IQKeyboardManager.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>16</integer>
</dict>
<key>MBProgressHUD.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>14</integer>
</dict>
<key>MJRefresh.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>17</integer>
</dict>
<key>Masonry.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>13</integer>
</dict>
<key>Pods-DreamSleep.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>12</integer>
</dict>
<key>Reachability.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
</dict>
<key>YYCache.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>11</integer>
</dict>
<key>YYImage.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>5</integer>
</dict>
<key>YYModel.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>8</integer>
</dict>
<key>YYWebImage.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>9</integer>
</dict>
<key>lottie-ios.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>18</integer>
</dict>
</dict>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Unity-iPhone.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
</dict>
<key>UnityFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>6</integer>
</dict>
</dict>
</dict>
</plist>
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!