Search code examples
iosios7pull-to-refreshuirefreshcontrol

ODRefreshControl isn´t working anymore


i tested my App on iOS 7 and recognize that my "Pull to Refresh" (ODRefreshControl https://github.com/Sephiroth87/ODRefreshControl) doesn´t work anymore.

I have to pull the scrollview extremly far down to see a small part of the spinner and the arrow icon. What could be the Problem. On iOS 5 and iOS 6 it works perfectley!!


Solution

  • I added only one Value in ODRefreshControl.m to fix the Issue for iOS7. Maybe the value is a little bit different from app to app!

    BEFORE:

    - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
    {
    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);
        }
        return;
    }
    

    AFTER:

    - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:     (NSDictionary *)change context:(void *)context
    {
    
    NSInteger iOS7Value = 60.0f;
    
    if ([keyPath isEqualToString:@"contentInset"]) 
    {
        if (!_ignoreInset) 
    {
            self.originalContentInset = [[change objectForKey:@"new"] UIEdgeInsetsValue];
    
            if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
    {
    
            self.frame = CGRectMake(0, -(kTotalViewHeight + self.scrollView.contentInset.top) + iOS7Value, self.scrollView.frame.size.width, kTotalViewHeight);
    
            } else {
    
                self.frame = CGRectMake(0, -(kTotalViewHeight + self.scrollView.contentInset.top), self.scrollView.frame.size.width, kTotalViewHeight);
            }
        }
        return;
    }