From 6337178e7c3ec5f586ae90424b2702628e0f4394 Mon Sep 17 00:00:00 2001 From: ShahiM Date: Mon, 23 Nov 2015 16:03:57 +0530 Subject: [PATCH] added pullThresholdFactorProperty --- SVPullToRefresh/UIScrollView+SVPullToRefresh.h | 2 ++ SVPullToRefresh/UIScrollView+SVPullToRefresh.m | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/SVPullToRefresh/UIScrollView+SVPullToRefresh.h b/SVPullToRefresh/UIScrollView+SVPullToRefresh.h index 73c92b7f..56f7fd63 100644 --- a/SVPullToRefresh/UIScrollView+SVPullToRefresh.h +++ b/SVPullToRefresh/UIScrollView+SVPullToRefresh.h @@ -49,6 +49,8 @@ typedef NS_ENUM(NSUInteger, SVPullToRefreshState) { @property (nonatomic, readonly) SVPullToRefreshState state; @property (nonatomic, readonly) SVPullToRefreshPosition position; +@property CGFloat pullThresholdFactor; + - (void)setTitle:(NSString *)title forState:(SVPullToRefreshState)state; - (void)setSubtitle:(NSString *)subtitle forState:(SVPullToRefreshState)state; - (void)setCustomView:(UIView *)view forState:(SVPullToRefreshState)state; diff --git a/SVPullToRefresh/UIScrollView+SVPullToRefresh.m b/SVPullToRefresh/UIScrollView+SVPullToRefresh.m index ba19078c..5585c55d 100644 --- a/SVPullToRefresh/UIScrollView+SVPullToRefresh.m +++ b/SVPullToRefresh/UIScrollView+SVPullToRefresh.m @@ -158,7 +158,7 @@ - (BOOL)showsPullToRefresh { @implementation SVPullToRefreshView // public properties -@synthesize pullToRefreshActionHandler, arrowColor, textColor, activityIndicatorViewColor, activityIndicatorViewStyle, lastUpdatedDate, dateFormatter; +@synthesize pullToRefreshActionHandler, arrowColor, textColor, activityIndicatorViewColor, activityIndicatorViewStyle, lastUpdatedDate, dateFormatter, pullThresholdFactor; @synthesize state = _state; @synthesize scrollView = _scrollView; @@ -188,6 +188,8 @@ - (id)initWithFrame:(CGRect)frame { self.subtitles = [NSMutableArray arrayWithObjects:@"", @"", @"", @"", nil]; self.viewForState = [NSMutableArray arrayWithObjects:@"", @"", @"", @"", nil]; self.wasTriggeredByUser = YES; + + self.pullThresholdFactor = 1.0f; } return self; @@ -402,6 +404,8 @@ - (void)scrollViewDidScroll:(CGPoint)contentOffset { break; } + scrollOffsetThreshold*=pullThresholdFactor; + if(!self.scrollView.isDragging && self.state == SVPullToRefreshStateTriggered) self.state = SVPullToRefreshStateLoading; else if(contentOffset.y < scrollOffsetThreshold && self.scrollView.isDragging && self.state == SVPullToRefreshStateStopped && self.position == SVPullToRefreshPositionTop)