From 01bd3e933b0cee08a927ec8226927aa0ff20ec73 Mon Sep 17 00:00:00 2001 From: lilidan Date: Tue, 3 Nov 2015 10:21:29 +0800 Subject: [PATCH] Fix the bug of tableViewHeader position caused by contentInset. --- Class/CBStoreHouseRefreshControl.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Class/CBStoreHouseRefreshControl.m b/Class/CBStoreHouseRefreshControl.m index 9a32d13..6b547f4 100644 --- a/Class/CBStoreHouseRefreshControl.m +++ b/Class/CBStoreHouseRefreshControl.m @@ -140,6 +140,15 @@ - (void)scrollViewDidScroll self.center = CGPointMake([UIScreen mainScreen].bounds.size.width/2, self.realContentOffsetY*krelativeHeightFactor); if (self.state == CBStoreHouseRefreshControlStateIdle) [self updateBarItemsWithProgress:self.animationProgress]; + + if (self.state == CBStoreHouseRefreshControlStateRefreshing) + { + CGFloat offset = MAX(self.scrollView.contentOffset.y * -1, 0.0f); + offset = MIN(offset, self.originalTopContentInset + self.dropHeight); + offset = MAX(offset, self.originalTopContentInset); + UIEdgeInsets contentInset = self.scrollView.contentInset; + self.scrollView.contentInset = UIEdgeInsetsMake(offset, contentInset.left, contentInset.bottom, contentInset.right); + } } - (void)scrollViewDidEndDragging