Commit 5f627515 cgx

细节优化

1 个父辈 d21a6df7
......@@ -33,6 +33,8 @@
D027EE3027FB52DA004BBA61 /* UIImage+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D027EE2F27FB52DA004BBA61 /* UIImage+Extras.m */; };
D027EE3227FB5464004BBA61 /* pull_down.gif in Resources */ = {isa = PBXBuildFile; fileRef = D027EE3127FB5464004BBA61 /* pull_down.gif */; };
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 */; };
D037C497284F4A22000F3089 /* SignTaskView.m in Sources */ = {isa = PBXBuildFile; fileRef = D037C496284F4A22000F3089 /* SignTaskView.m */; };
D037C49A284F4F0D000F3089 /* DailyTaskCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D037C499284F4F0D000F3089 /* DailyTaskCell.m */; };
D037C49D284F5DE8000F3089 /* DailyTaskSrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = D037C49C284F5DE8000F3089 /* DailyTaskSrollView.m */; };
......@@ -284,6 +286,10 @@
D027EE3127FB5464004BBA61 /* pull_down.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = pull_down.gif; 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>"; };
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>"; };
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>"; };
D037C496284F4A22000F3089 /* SignTaskView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SignTaskView.m; sourceTree = "<group>"; };
D037C498284F4F0D000F3089 /* DailyTaskCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DailyTaskCell.h; sourceTree = "<group>"; };
......@@ -1059,6 +1065,10 @@
D037C499284F4F0D000F3089 /* DailyTaskCell.m */,
D0D4107A2844B8DB00009638 /* DailyTaskController.h */,
D0D4107B2844B8DB00009638 /* DailyTaskController.m */,
D0336161285035AB005573CF /* DailyBgView.h */,
D0336162285035AB005573CF /* DailyBgView.m */,
D033615E28502B76005573CF /* DailyTaskTV.h */,
D033615F28502B76005573CF /* DailyTaskTV.m */,
D037C49B284F5DE8000F3089 /* DailyTaskSrollView.h */,
D037C49C284F5DE8000F3089 /* DailyTaskSrollView.m */,
D0D4107D2844D38400009638 /* RankModel.h */,
......@@ -1787,6 +1797,7 @@
D0E65FFB2807A654006562F2 /* NSDictionary+HYBUnicodeReadable.m in Sources */,
D0A245F6283DB12100FB49AA /* WKWebView+Extras.m in Sources */,
D0E65FFA2807A654006562F2 /* NSArray+HYBUnicodeReadable.m in Sources */,
D033616028502B76005573CF /* DailyTaskTV.m in Sources */,
D08F79DE281A1838000D99DD /* TZPhotoPickerController.m in Sources */,
D04B3DC027F6F82D0022F8DF /* ProfileController.m in Sources */,
D01C9D7028168BFC00163567 /* NSDate+Extension.m in Sources */,
......@@ -1887,6 +1898,7 @@
D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */,
D030C1B8284775930014946F /* RelaxTrainController.m in Sources */,
D049679D2834E1AB00FB81E5 /* ProfileHeaderView.m in Sources */,
D0336163285035AB005573CF /* DailyBgView.m in Sources */,
D0FAC421281B817D00D4B859 /* GKPhotoView.m in Sources */,
D091E66E283F29D100D3279E /* ScoreDetailController.m in Sources */,
D00A63572824C42300AFFEAA /* DSNetworkCache.m in Sources */,
......
//
// DailyBgView.h
// DreamSleep
//
// Created by peter on 2022/6/8.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 每日任务背景视图
@interface DailyBgView : UIView
@end
NS_ASSUME_NONNULL_END
//
// DailyBgView.m
// DreamSleep
//
// Created by peter on 2022/6/8.
//
#import "DailyBgView.h"
@interface DailyBgView ()
@property (nonatomic, strong) UIImageView *bgIV;
@property (nonatomic, strong) UILabel *pointsLab;
@property (nonatomic, strong) UILabel *todayLab;
@end
@implementation DailyBgView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self addSubview:self.bgIV];
[self addSubview:self.pointsLab];
[self addSubview:self.todayLab];
}
return self;
}
#pragma mark - lazy
- (UIImageView *)bgIV {
if (!_bgIV) {
_bgIV = [[UIImageView alloc] dk_initWithImagePicker:DKImagePickerWithNames(@"bg_rw", @"dk_bg_rw", @"dk_bg_rw")];
_bgIV.frame = self.bounds;
}
return _bgIV;
}
@end
......@@ -7,22 +7,21 @@
#import "DailyTaskController.h"
#import "ScoreTaskRequestModel.h"
#import "SignTaskView.h"
#import "DailyTaskCell.h"
#import "DailyTaskSrollView.h"
#import "DailyBgView.h"
#import "DailyTaskTV.h"
@interface DailyTaskController () <UIScrollViewDelegate, UITableViewDelegate, UITableViewDataSource>
@interface DailyTaskController () <UIScrollViewDelegate>
@property (nonatomic, strong) DailyTaskSrollView *dtSrollView;
@property (nonatomic, strong) UIImageView *bgIV;
@property (nonatomic, strong) UITableView *taskTableView;
@property (nonatomic, strong) SignTaskView *signTaskView;
@property (nonatomic, strong) DailyBgView *dailyBgView;
@property (nonatomic, strong) DailyTaskTV *taskTableView;
@end
@implementation DailyTaskController
- (void)viewDidLoad {
[super viewDidLoad];
[self initUI];
[ScoreTaskRequestModel queryUserSignListWithCompletion:^(ScoreTaskRequestModel * _Nonnull requestModel) {
......@@ -43,56 +42,26 @@
self.naviBgColor = DSClearColor;
self.naviBarAlpha = 1.0;
[self.dsNaviBar addSubview:self.backBtn];
[self.view insertSubview:self.dtSrollView belowSubview:self.dsNaviBar];
[self.dtSrollView addSubview:self.bgIV];
[self.dtSrollView addSubview:self.dailyBgView];
[self.dtSrollView addSubview:self.taskTableView];
[self.dtSrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
self.taskTableView.height = self.signTaskView.height + 20*50 + 30;
self.dtSrollView.contentSize = CGSizeMake(kScreenWidth, self.bgIV.height + self.taskTableView.height);
self.dtSrollView.contentSize = CGSizeMake(kScreenWidth, self.dailyBgView.height + self.taskTableView.height - 50);
}
#pragma mark - UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGFloat offsetY = scrollView.contentOffset.y;
DSLog(@"offsetY:%f", scrollView.contentOffset.y);
if (scrollView == self.dtSrollView) {
self.dtSrollView.bounces = offsetY <= 0 ? NO : YES;
// if (offsetY == 0) {
// self.taskTableView.scrollEnabled = YES;
// self.dtSrollView.scrollEnabled = NO;
// }
} else {
// if (offsetY > 0) {
// self.taskTableView.scrollEnabled = NO;
// self.dtSrollView.scrollEnabled = YES;
// // 修正
// self.taskTableView.contentOffset = CGPointMake(0, 0);
// }
}
}
#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;
}
#pragma mark - lazy
- (DailyTaskSrollView *)dtSrollView {
if (!_dtSrollView) {
......@@ -104,35 +73,18 @@
return _dtSrollView;
}
- (UIImageView *)bgIV {
if (!_bgIV) {
_bgIV = [[UIImageView alloc] dk_initWithImagePicker:DKImagePickerWithNames(@"bg_rw", @"dk_bg_rw", @"dk_bg_rw")];
_bgIV.frame = CGRectMake(0, 0, kScreenWidth, kScreenWidth*300/375.0);
- (DailyBgView *)dailyBgView {
if (!_dailyBgView) {
_dailyBgView = [[DailyBgView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenWidth*300/375.0)];
}
return _bgIV;
return _dailyBgView;
}
- (UITableView *)taskTableView {
- (DailyTaskTV *)taskTableView {
if (!_taskTableView) {
_taskTableView = [[UITableView alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(self.bgIV.frame), kScreenWidth - 30, 500) style:UITableViewStyleGrouped];
_taskTableView.backgroundColor = DSClearColor;
[_taskTableView debugViewShowBorderWithColor:DSBlack];
_taskTableView.delegate = self;
_taskTableView.dataSource = self;
_taskTableView.tableHeaderView = self.signTaskView;
_taskTableView.rowHeight = 50;
_taskTableView.showsVerticalScrollIndicator = NO;
_taskTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[_taskTableView registerClass:[DailyTaskCell class] forCellReuseIdentifier:NSStringFromClass([DailyTaskCell class])];
_taskTableView = [[DailyTaskTV alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(self.dailyBgView.frame) - 50, kScreenWidth - 30, 500) style:UITableViewStyleGrouped];
}
return _taskTableView;
}
- (SignTaskView *)signTaskView {
if (!_signTaskView) {
_signTaskView = [[SignTaskView alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(self.bgIV.frame), kScreenWidth - 30, 186)];
}
return _signTaskView;
}
@end
......@@ -9,9 +9,8 @@
@implementation DailyTaskSrollView
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecogn {
DSLog(@"哈哈哈哈...");
return YES;
}
//- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecogn {
// return YES;
//}
@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
......@@ -50,7 +50,7 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "ReleaseForRunning"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!