Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions MJRefreshExample/Classes/First/MJExampleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ - (void)viewDidLoad

// 下拉刷新
tableView.mj_header= [MJRefreshNormalHeader headerWithRefreshingBlock:^{
__strong typeof(tableView) strongTableView = tableView;
// 模拟延迟加载数据,因此2秒后才调用(真实开发中,可以移除这段gcd代码)
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 结束刷新
[tableView.mj_header endRefreshing];
[strongTableView.mj_header endRefreshing];
});
}];

Expand All @@ -78,10 +79,11 @@ - (void)viewDidLoad

// 上拉刷新
tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
__strong typeof(tableView) strongTableView = tableView;
// 模拟延迟加载数据,因此2秒后才调用(真实开发中,可以移除这段gcd代码)
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 结束刷新
[tableView.mj_footer endRefreshing];
[strongTableView.mj_footer endRefreshing];
});
}];
}
Expand Down
6 changes: 4 additions & 2 deletions MJRefreshExample/Classes/First/MJSingleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,19 @@ - (void)viewDidLoad {
__unsafe_unretained UITableView *tableView = self.tableView;

tableView.mj_header= [MJRefreshNormalHeader headerWithRefreshingBlock:^{
__strong typeof(weakSelf) strongSelf = weakSelf;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
weakSelf.count += 12;
strongSelf.count += 12;
[tableView reloadData];
[tableView.mj_header endRefreshing];
});
}];
tableView.mj_header.automaticallyChangeAlpha = YES;

MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
__strong typeof(weakSelf) strongSelf = weakSelf;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
weakSelf.count += 5;
strongSelf.count += 5;
[tableView reloadData];
[tableView.mj_footer endRefreshing];
});
Expand Down