CoderMJLee/MJRefresh

自定义header,下拉过快,程序崩溃

Opened this issue · 2 comments

  • (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
    {
    // 遇到这些情况就直接返回
    if (!self.userInteractionEnabled) return;

    // 这个就算看不见也需要处理
    if ([keyPath isEqualToString:MJRefreshKeyPathContentSize]) {
    [self scrollViewContentSizeDidChange:change];
    }

    // 看不见
    if (self.hidden) return;
    if ([keyPath isEqualToString:MJRefreshKeyPathContentOffset]) {
    [self scrollViewContentOffsetDidChange:change]; 此处位置会崩溃
    } else if ([keyPath isEqualToString:MJRefreshKeyPathPanState]) {
    [self scrollViewPanStateDidChange:change];
    }
    }