Skip to content

Commit

Permalink
Add other pull down refreshing methods, fix the end load more for mes…
Browse files Browse the repository at this point in the history
…sage tips view
  • Loading branch information
xhzengAIB committed Sep 2, 2015
1 parent 441a682 commit c9334ff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions RefreshControl/Manager/XHRefreshControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
*/
- (void)startPullDownRefreshing;

- (void)startControlPixelPullDownRefreshing;

/**
* 停止下拉刷新的方法
*/
Expand Down
18 changes: 14 additions & 4 deletions RefreshControl/Manager/XHRefreshControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,19 @@ @interface XHRefreshControl ()
// Handle Network Error
@property (nonatomic, assign) BOOL handleNetworkError;

@property (nonatomic, assign) BOOL shouldNeedControlAutoPullDownPixel;

@end

@implementation XHRefreshControl

#pragma mark - Pull Down Refreshing Method

- (void)startControlPixelPullDownRefreshing {
self.shouldNeedControlAutoPullDownPixel = YES;
[self startPullDownRefreshing];
}

- (void)startPullDownRefreshing {
if (self.isPullDownRefreshed) {
self.pullDownRefreshing = YES;
Expand Down Expand Up @@ -122,6 +129,7 @@ - (void)callBeginPullDownRefreshing {
}

- (void)endPullDownRefreshing {
self.shouldNeedControlAutoPullDownPixel = NO;
if (self.isPullDownRefreshed) {
[self setupRefreshTime];

Expand Down Expand Up @@ -189,7 +197,6 @@ - (void)endMoreOverWithMessage:(NSString *)message {
}

- (void)endMoreOverWithMessageTipsView:(UIView *)messageTipsView {
[self endLoadMoreRefresing];
self.noMoreDataForLoaded = YES;
self.handleNetworkError = NO;
self.loadMoreView.hidden = NO;
Expand Down Expand Up @@ -392,6 +399,9 @@ - (CGFloat)refreshTotalPixels {
}

- (CGFloat)getAdaptorHeight {
if (self.shouldNeedControlAutoPullDownPixel) {
return 0;
}
return self.originalTopInset;
}

Expand Down Expand Up @@ -709,9 +719,9 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
// CGFloat scrollViewHeight = CGRectGetHeight(self.scrollView.frame);
// CGFloat thubs = scrollViewHeight - [self getAdaptorHeight];
// if (contentSize.height >= thubs) {
CGRect loadMoreViewFrame = self.loadMoreView.frame;
loadMoreViewFrame.origin.y = contentSize.height;
self.loadMoreView.frame = loadMoreViewFrame;
CGRect loadMoreViewFrame = self.loadMoreView.frame;
loadMoreViewFrame.origin.y = contentSize.height;
self.loadMoreView.frame = loadMoreViewFrame;
// }
}
}
Expand Down
6 changes: 6 additions & 0 deletions RefreshControl/Views/XHLoadMoreView.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ - (void)setupNormalButton {
[self hideMessageView];
}

- (void)setupNoneDataStauts {
self.loadMoreButton.hidden = YES;
[self.activityIndicatorView stopAnimating];
}

- (void)hideMessageView {
if (_messageView) {
_messageView.hidden = YES;
Expand Down Expand Up @@ -65,6 +70,7 @@ - (void)configuraNothingMoreWithMessageView:(UIView *)messageView {
_messageView.hidden = NO;
return;
}
[self setupNoneDataStauts];
messageView.backgroundColor = self.loadMoreButton.backgroundColor;
self.messageView = messageView;
[self addSubview:self.messageView];
Expand Down

0 comments on commit c9334ff

Please sign in to comment.