diff --git a/SSPullToRefresh/SSPullToRefreshView.h b/SSPullToRefresh/SSPullToRefreshView.h index 94e8449..8cd6e1b 100644 --- a/SSPullToRefresh/SSPullToRefreshView.h +++ b/SSPullToRefresh/SSPullToRefreshView.h @@ -82,6 +82,12 @@ typedef NS_ENUM(NSUInteger, SSPullToRefreshViewStyle) { */ @property (nonatomic, assign) UIEdgeInsets defaultContentInset; +/** + Safe area of scroll view. + Since iOS11 views have safeAreaInsets `scrollView` `contentOffset` is dependent upon the safe areas. This property is used when calculating current pull state. + */ +@property (nonatomic) UIEdgeInsets defaultSafeArea; + /** The height of the fully expanded content view. The default is `70.0`. diff --git a/SSPullToRefresh/SSPullToRefreshView.m b/SSPullToRefresh/SSPullToRefreshView.m index 24a9cb0..51d950b 100644 --- a/SSPullToRefresh/SSPullToRefreshView.m +++ b/SSPullToRefresh/SSPullToRefreshView.m @@ -30,6 +30,7 @@ @implementation SSPullToRefreshView @synthesize topInset = _topInset; @synthesize animationSemaphore = _animationSemaphore; @synthesize style = _style; +@synthesize defaultSafeArea = _defaultSafeArea; #pragma mark - Accessors @@ -362,7 +363,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N } // Get the offset out of the change notification - CGFloat y = [[change objectForKey:NSKeyValueChangeNewKey] CGPointValue].y + self.defaultContentInset.top; + CGFloat y = [[change objectForKey:NSKeyValueChangeNewKey] CGPointValue].y + self.defaultContentInset.top + self.defaultSafeArea.top; // Scroll view is dragging if (self.scrollView.isDragging) {