Skip to content

Commit 24a2b23

Browse files
committed
加载更多~
1 parent b719f8b commit 24a2b23

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

Coding_iOS/Controllers/ProjectSquareViewController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ - (void)viewDidLoad {
3131
[listView mas_makeConstraints:^(MASConstraintMaker *make) {
3232
make.edges.equalTo(self.view);
3333
}];
34+
3435
}
3536

3637
- (void)didReceiveMemoryWarning {

Coding_iOS/Views/Cell/ProjectPublicListCell.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,7 @@ - (void)setProject:(Project *)project hasSWButtons:(BOOL)hasSWButtons hasBadgeTi
189189
NSString *titleStr=[NSString stringWithFormat:@"%@ 最后更新于 %@",_project.owner_user_name,[_project.updated_at stringDisplay_HHmm]];
190190
NSMutableAttributedString *titleColorStr=[[NSMutableAttributedString alloc] initWithString:titleStr];
191191
[titleColorStr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:@"0x3bbd79"] range:[titleStr rangeOfString:_project.owner_user_name]];
192-
//
193-
// [titleColorStr addAttribute:NSForegroundColorAttributeName value:ZZBThemeOrangeColor range:[titleStr rangeOfString:aPerson.text]];
194-
// _nameLabel.text = [NSString stringWithFormat:@"%@(%ld)", _folder.name, (long)(_folder.count.integerValue)];
195-
// _infoLabel.text = [NSString stringWithFormat:@"%@ 创建于 %@", _folder.owner_name, ];
196-
192+
197193
_ownerTitleLabel.attributedText = titleColorStr;
198194

199195

Coding_iOS/Views/TableListView/ProjectListView.m

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#import "ProjectAboutMeListCell.h"
1717
#import "ProjectAboutOthersListCell.h"
1818
#import "ProjectPublicListCell.h"
19+
#import "SVPullToRefresh.h"
1920

2021
@interface ProjectListView ()<UISearchBarDelegate, SWTableViewCellDelegate>
2122
@property (nonatomic, strong) Projects *myProjects;
@@ -90,7 +91,12 @@ - (id)initWithFrame:(CGRect)frame projects:(Projects *)projects block:(ProjectLi
9091

9192
_myRefreshControl = [[ODRefreshControl alloc] initInScrollView:self.myTableView];
9293
[_myRefreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged];
94+
__weak typeof(self) weakSelf = self;
9395

96+
[_myTableView addInfiniteScrollingWithActionHandler:^{
97+
[weakSelf refreshMore];
98+
}];
99+
94100
if (_myProjects.list.count > 0) {
95101
[_myTableView reloadData];
96102
}else{
@@ -167,14 +173,26 @@ - (void)refreshFirst{
167173
}
168174
}
169175

176+
- (void)refreshMore{
177+
if (_myProjects.isLoading || !_myProjects.canLoadMore) {
178+
[_myTableView.infiniteScrollingView stopAnimating];
179+
return;
180+
}
181+
_myProjects.willLoadMore = YES;
182+
[self sendRequest];
183+
}
184+
185+
170186
- (void)sendRequest{
171187
if (_myProjects.list.count <= 0) {
172188
[self beginLoading];
173189
}
174190
__weak typeof(self) weakSelf = self;
175191
[[Coding_NetAPIManager sharedManager] request_Projects_WithObj:_myProjects andBlock:^(Projects *data, NSError *error) {
176192
[weakSelf.myRefreshControl endRefreshing];
177-
[self endLoading];
193+
[weakSelf endLoading];
194+
[weakSelf.myTableView.infiniteScrollingView stopAnimating];
195+
178196
if (data) {
179197
[weakSelf.myProjects configWithProjects:data];
180198
[weakSelf setupDataList];

0 commit comments

Comments
 (0)