Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "kTopOffset" parameter to make RefreshControl work on Apps with "translucent" header bar #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions ODRefreshControl/ODRefreshControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define kMinArrowRadius 5
#define kMaxArrowRadius 7
#define kMaxDistance 53
#define kTopOffset 44//offset of the parent table-view (e.g. translucent header-bar)

@interface ODRefreshControl ()

Expand Down Expand Up @@ -53,7 +54,7 @@ - (id)initInScrollView:(UIScrollView *)scrollView {

- (id)initInScrollView:(UIScrollView *)scrollView activityIndicatorView:(UIView *)activity
{
self = [super initWithFrame:CGRectMake(0, -(kTotalViewHeight + scrollView.contentInset.top), scrollView.frame.size.width, kTotalViewHeight)];
self = [super initWithFrame:CGRectMake(0, -(kTotalViewHeight + scrollView.contentInset.top - kTopOffset), scrollView.frame.size.width, kTotalViewHeight)];

if (self) {
self.scrollView = scrollView;
Expand Down Expand Up @@ -168,7 +169,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
if ([keyPath isEqualToString:@"contentInset"]) {
if (!_ignoreInset) {
self.originalContentInset = [[change objectForKey:@"new"] UIEdgeInsetsValue];
self.frame = CGRectMake(0, -(kTotalViewHeight + self.scrollView.contentInset.top), self.scrollView.frame.size.width, kTotalViewHeight);
self.frame = CGRectMake(0, -(kTotalViewHeight + self.scrollView.contentInset.top - kTopOffset), self.scrollView.frame.size.width, kTotalViewHeight);
}
return;
}
Expand Down