Skip to content
This repository was archived by the owner on Aug 24, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions SSPullToRefresh/SSPullToRefreshView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
3 changes: 2 additions & 1 deletion SSPullToRefresh/SSPullToRefreshView.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ @implementation SSPullToRefreshView
@synthesize topInset = _topInset;
@synthesize animationSemaphore = _animationSemaphore;
@synthesize style = _style;
@synthesize defaultSafeArea = _defaultSafeArea;


#pragma mark - Accessors
Expand Down Expand Up @@ -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) {
Expand Down