Skip to content

Commit fa88de8

Browse files
MJ LeeMJ Lee
MJ Lee
authored and
MJ Lee
committed
Remove unnecessary code
1 parent e7d9dec commit fa88de8

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

MJRefreshExample/MJRefreshExample/Classes/Controller/MJCollectionViewController.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ - (void)addHeader
9393
[vc.fakeColors insertObject:MJRandomColor atIndex:0];
9494
}
9595

96-
// 模拟延迟加载数据,因此2秒后才调用)
96+
// 模拟延迟加载数据,因此2秒后才调用(真实开发中,可以移除这段gcd代码
9797
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
9898
[vc.collectionView reloadData];
9999
// 结束刷新
@@ -117,7 +117,7 @@ - (void)addFooter
117117
[vc.fakeColors addObject:MJRandomColor];
118118
}
119119

120-
// 模拟延迟加载数据,因此2秒后才调用)
120+
// 模拟延迟加载数据,因此2秒后才调用(真实开发中,可以移除这段gcd代码
121121
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
122122
[vc.collectionView reloadData];
123123
// 结束刷新

MJRefreshExample/MJRefreshExample/Classes/Controller/MJTableViewController.m

+13-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ - (NSMutableArray *)fakeData
3636
if (!_fakeData) {
3737
self.fakeData = [NSMutableArray array];
3838

39-
for (int i = 0; i<12; i++) {
39+
for (int i = 0; i<5; i++) {
4040
[self.fakeData addObject:MJRandomData];
4141
}
4242
}
@@ -95,7 +95,7 @@ - (void)headerRereshing
9595
[self.fakeData insertObject:MJRandomData atIndex:0];
9696
}
9797

98-
// 2.2秒后刷新表格UI
98+
// 2.模拟2秒后刷新表格UI(真实开发中,可以移除这段gcd代码)
9999
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
100100
// 刷新表格
101101
[self.tableView reloadData];
@@ -112,7 +112,7 @@ - (void)footerRereshing
112112
[self.fakeData addObject:MJRandomData];
113113
}
114114

115-
// 2.2秒后刷新表格UI
115+
// 2.模拟2秒后刷新表格UI(真实开发中,可以移除这段gcd代码)
116116
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
117117
// 刷新表格
118118
[self.tableView reloadData];
@@ -123,6 +123,11 @@ - (void)footerRereshing
123123
}
124124

125125
#pragma mark - Table view data source
126+
//- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
127+
//{
128+
// return 5;
129+
//}
130+
126131
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
127132
{
128133
return self.fakeData.count;
@@ -141,4 +146,9 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
141146
MJTestViewController *test = [[MJTestViewController alloc] init];
142147
[self.navigationController pushViewController:test animated:YES];
143148
}
149+
150+
//- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
151+
//{
152+
// return @"test";
153+
//}
144154
@end

MJRefreshExample/MJRefreshExample/MJRefresh/MJRefreshBaseView.m

-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ - (BOOL)isRefreshing
130130
}
131131

132132
#pragma mark 开始刷新
133-
typedef void (*send_type)(void *, SEL, UIView *);
134133
- (void)beginRefreshing
135134
{
136135
if (self.state == MJRefreshStateRefreshing) {
@@ -148,7 +147,6 @@ - (void)beginRefreshing
148147
} else {
149148
#warning 不能调用set方法
150149
_state = MJRefreshStateWillRefreshing;
151-
[super setNeedsDisplay];
152150
}
153151
}
154152
}

MJRefreshExample/MJRefreshExample/MJRefresh/UIScrollView+MJRefresh.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ - (BOOL)isHeaderHidden
126126

127127
- (BOOL)isHeaderRefreshing
128128
{
129-
return self.header.state == MJRefreshStateRefreshing;
129+
return self.header.isRefreshing;
130130
}
131131

132132
#pragma mark - 上拉刷新
@@ -208,7 +208,7 @@ - (BOOL)isFooterHidden
208208

209209
- (BOOL)isFooterRefreshing
210210
{
211-
return self.footer.state == MJRefreshStateRefreshing;
211+
return self.footer.isRefreshing;
212212
}
213213

214214
/**

0 commit comments

Comments
 (0)