Skip to content

Commit 1b4cc45

Browse files
committed
下拉刷新bug修复
1 parent edddac8 commit 1b4cc45

File tree

8 files changed

+18
-10
lines changed

8 files changed

+18
-10
lines changed

Coding_iOS/Controllers/RootControllers/Me_RootViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ @implementation Me_RootViewController
4242
- (void)tabBarItemClicked{
4343
if (_myTableView.contentOffset.y > 0) {
4444
[_myTableView setContentOffset:CGPointZero animated:YES];
45-
}else if (!self.refreshControl.refreshing){
45+
}else if (!self.refreshControl.isAnimating){
4646
[self.refreshControl beginRefreshing];
4747
[self.myTableView setContentOffset:CGPointMake(0, -44)];
4848
[self refresh];

Coding_iOS/Controllers/RootControllers/Message_RootViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ @implementation Message_RootViewController
3636
- (void)tabBarItemClicked{
3737
if (_myTableView.contentOffset.y > 0) {
3838
[_myTableView setContentOffset:CGPointZero animated:YES];
39-
}else if (!self.refreshControl.refreshing){
39+
}else if (!self.refreshControl.isAnimating){
40+
[self.refreshControl beginRefreshing];
4041
[self.myTableView setContentOffset:CGPointMake(0, -44)];
4142
[self refresh];
4243
}

Coding_iOS/Controllers/RootControllers/Tweet_RootViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ @implementation Tweet_RootViewController
5252
- (void)tabBarItemClicked{
5353
if (_myTableView.contentOffset.y > 0) {
5454
[_myTableView setContentOffset:CGPointZero animated:YES];
55-
}else if (!self.refreshControl.refreshing){
55+
}else if (!self.refreshControl.isAnimating){
5656
[self.refreshControl beginRefreshing];
5757
[self.myTableView setContentOffset:CGPointMake(0, -44)];
5858
[self refresh];

Coding_iOS/Vendor/ODRefreshControl/ODRefreshControl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
BOOL _hasSectionHeaders;
2525
}
2626

27-
@property (nonatomic, readonly) BOOL refreshing;
27+
@property (nonatomic, readonly) BOOL isAnimating;
28+
2829
@property (nonatomic, strong) UIColor *tintColor;
2930
@property (nonatomic, assign) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
3031

@@ -38,5 +39,4 @@
3839

3940
// Tells the control the refresh operation has ended
4041
- (void)endRefreshing;
41-
4242
@end

Coding_iOS/Vendor/ODRefreshControl/ODRefreshControl.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
@interface ODRefreshControl ()
3030

31-
@property (nonatomic, readwrite) BOOL refreshing;
31+
@property (nonatomic, readwrite) BOOL refreshing, duringEnding;
3232
@property (nonatomic, assign) UIScrollView *scrollView;
3333
@property (nonatomic, assign) UIEdgeInsets originalContentInset;
3434

@@ -74,6 +74,7 @@ - (id)initInScrollView:(UIScrollView *)scrollView activityIndicatorView:(UIView
7474
[self addSubview:_activity];
7575

7676
_refreshing = NO;
77+
_duringEnding = NO;
7778
_canRefresh = YES;
7879
_ignoreInset = NO;
7980
_ignoreOffset = NO;
@@ -391,6 +392,8 @@ - (void)beginRefreshing
391392
- (void)endRefreshing
392393
{
393394
if (_refreshing) {
395+
self.refreshing = NO;
396+
self.duringEnding = YES;
394397
// Create a temporary retain-cycle, so the scrollView won't be released
395398
// halfway through the end animation.
396399
// This allows for the refresh control to clean up the observer,
@@ -416,9 +419,13 @@ - (void)endRefreshing
416419
_ignoreInset = YES;
417420
[blockScrollView setContentInset:self.originalContentInset];
418421
_ignoreInset = NO;
419-
_refreshing = NO;
422+
self.duringEnding = NO;
420423
}];
421424
}
422425
}
423426

427+
- (BOOL)isAnimating{
428+
return (self.refreshing || self.duringEnding);
429+
}
430+
424431
@end

Coding_iOS/Views/FileDownloadView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ - (void)loadLayoutWithCurFile{
9191
curBottomY += 20;
9292
if (!_stateButton) {
9393
_stateButton = [[UIButton alloc] init];
94-
_stateButton = [UIButton buttonWithStyle:StrapPrimaryStyle andTitle:@"下载原文件" andFrame:CGRectMake((frameWidth - 260)/2, curBottomY, 260, 45) target:self action:@selector(clickedByUser)];
94+
_stateButton = [UIButton buttonWithStyle:StrapPrimaryStyle andTitle:@"下载原文件" andFrame:CGRectMake((frameWidth - 260)/2, curBottomY, 260, 25) target:self action:@selector(clickedByUser)];
9595
[self addSubview:_stateButton];
9696
}
9797
}else{

Coding_iOS/Views/ProjectListView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ @implementation ProjectListView
3030
- (void)tabBarItemClicked{
3131
if (_myTableView.contentOffset.y > 0) {
3232
[_myTableView setContentOffset:CGPointZero animated:YES];
33-
}else if (!self.myRefreshControl.refreshing){
33+
}else if (!self.myRefreshControl.isAnimating){
3434
[self.myRefreshControl beginRefreshing];
3535
[self.myTableView setContentOffset:CGPointMake(0, -44)];
3636
[self refresh];

Coding_iOS/Views/ProjectTaskListView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ @implementation ProjectTaskListView
3030
- (void)tabBarItemClicked{
3131
if (_myTableView.contentOffset.y > 0) {
3232
[_myTableView setContentOffset:CGPointZero animated:YES];
33-
}else if (!self.myRefreshControl.refreshing){
33+
}else if (!self.myRefreshControl.isAnimating){
3434
[self.myRefreshControl beginRefreshing];
3535
[self.myTableView setContentOffset:CGPointMake(0, -44)];
3636
[self refresh];

0 commit comments

Comments
 (0)