Skip to content

Commit

Permalink
一些小问题
Browse files Browse the repository at this point in the history
1.考虑到项目中没有PCH的情况,需要手动包含UIKit.h
2.Demo小改动
  • Loading branch information
520dev committed Jul 22, 2016
1 parent 87a1299 commit e8a584b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion MJRefresh.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'MJRefresh'
s.version = '3.1.9'
s.version = '3.1.11'
s.summary = 'An easy way to use pull-to-refresh'
s.homepage = 'https://github.com/CoderMJLee/MJRefresh'
s.license = 'MIT'
Expand Down
2 changes: 1 addition & 1 deletion MJRefresh/NSBundle+MJRefresh.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016年 小码哥. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface NSBundle (MJRefresh)
+ (instancetype)mj_refreshBundle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ @implementation MJCollectionViewController
#pragma mark UICollectionView 上下拉刷新
- (void)example21
{
__unsafe_unretained __typeof(self) weakSelf = self;
__weak __typeof(self) weakSelf = self;

// 下拉刷新
self.collectionView.mj_header= [MJRefreshNormalHeader headerWithRefreshingBlock:^{
Expand Down
24 changes: 14 additions & 10 deletions MJRefreshExample/Classes/Second/MJTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ @implementation MJTableViewController
#pragma mark UITableView + 下拉刷新 默认
- (void)example01
{
__unsafe_unretained __typeof(self) weakSelf = self;
__weak __typeof(self) weakSelf = self;

// 设置回调(一旦进入刷新状态就会调用这个refreshingBlock)
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
Expand Down Expand Up @@ -135,7 +135,7 @@ - (void)example11
{
[self example01];

__unsafe_unretained __typeof(self) weakSelf = self;
__weak __typeof(self) weakSelf = self;

// 设置回调(一旦进入刷新状态就会调用这个refreshingBlock)
self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
Expand Down Expand Up @@ -288,12 +288,13 @@ - (void)loadNewData
}

// 2.模拟2秒后刷新表格UI(真实开发中,可以移除这段gcd代码)
__weak UITableView *tableView = self.tableView;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(MJDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 刷新表格
[self.tableView reloadData];
[tableView reloadData];

// 拿到当前的下拉刷新控件,结束刷新状态
[self.tableView.mj_header endRefreshing];
[tableView.mj_header endRefreshing];
});
}

Expand All @@ -306,12 +307,13 @@ - (void)loadMoreData
}

// 2.模拟2秒后刷新表格UI(真实开发中,可以移除这段gcd代码)
__weak UITableView *tableView = self.tableView;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(MJDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 刷新表格
[self.tableView reloadData];
[tableView reloadData];

// 拿到当前的上拉刷新控件,结束刷新状态
[self.tableView.mj_footer endRefreshing];
[tableView.mj_footer endRefreshing];
});
}

Expand All @@ -324,12 +326,13 @@ - (void)loadLastData
}

// 2.模拟2秒后刷新表格UI(真实开发中,可以移除这段gcd代码)
__weak UITableView *tableView = self.tableView;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(MJDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 刷新表格
[self.tableView reloadData];
[tableView reloadData];

// 拿到当前的上拉刷新控件,变为没有更多数据的状态
[self.tableView.mj_footer endRefreshingWithNoMoreData];
[tableView.mj_footer endRefreshingWithNoMoreData];
});
}

Expand All @@ -342,12 +345,13 @@ - (void)loadOnceData
}

// 2.模拟2秒后刷新表格UI(真实开发中,可以移除这段gcd代码)
__weak UITableView *tableView = self.tableView;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(MJDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 刷新表格
[self.tableView reloadData];
[tableView reloadData];

// 隐藏当前的上拉刷新控件
self.tableView.mj_footer.hidden = YES;
tableView.mj_footer.hidden = YES;
});
}

Expand Down
4 changes: 2 additions & 2 deletions MJRefreshExample/Classes/Second/MJWebViewViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ @implementation MJWebViewViewController
#pragma mark - 示例
- (void)example31
{
__unsafe_unretained UIWebView *webView = self.webView;
__weak UIWebView *webView = self.webView;
webView.delegate = self;

__unsafe_unretained UIScrollView *scrollView = self.webView.scrollView;
__weak UIScrollView *scrollView = self.webView.scrollView;

// 添加下拉刷新控件
scrollView.mj_header= [MJRefreshNormalHeader headerWithRefreshingBlock:^{
Expand Down

0 comments on commit e8a584b

Please sign in to comment.