From 50e0ec7aefe89ca4a1f4b531b158bbed00440e95 Mon Sep 17 00:00:00 2001 From: kingiol Date: Wed, 13 Jan 2016 18:05:03 +0800 Subject: [PATCH 1/2] fix contentInset when use the control on UIScrollView In UIViewController --- Class/CBStoreHouseRefreshControl.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Class/CBStoreHouseRefreshControl.m b/Class/CBStoreHouseRefreshControl.m index 9a32d13..081f49c 100644 --- a/Class/CBStoreHouseRefreshControl.m +++ b/Class/CBStoreHouseRefreshControl.m @@ -136,7 +136,7 @@ + (CBStoreHouseRefreshControl*)attachToScrollView:(UIScrollView *)scrollView - (void)scrollViewDidScroll { - if (self.originalTopContentInset == 0) self.originalTopContentInset = self.scrollView.contentInset.top; + if (self.originalTopContentInset == 0 && self.state != CBStoreHouseRefreshControlStateRefreshing) self.originalTopContentInset = self.scrollView.contentInset.top; self.center = CGPointMake([UIScreen mainScreen].bounds.size.width/2, self.realContentOffsetY*krelativeHeightFactor); if (self.state == CBStoreHouseRefreshControlStateIdle) [self updateBarItemsWithProgress:self.animationProgress]; @@ -176,7 +176,7 @@ - (void)scrollViewDidEndDragging - (CGFloat)animationProgress { - return MIN(1.f, MAX(0, fabsf(self.realContentOffsetY)/self.dropHeight)); + return MIN(1.f, MAX(0, fabs(self.realContentOffsetY)/self.dropHeight)); } - (CGFloat)realContentOffsetY From 01dcc93eeb9e0a52c159cafe0d38927a09d47692 Mon Sep 17 00:00:00 2001 From: kingiol Date: Thu, 14 Jan 2016 17:51:11 +0800 Subject: [PATCH 2/2] fix linewidth overstep the boundary --- Class/CBStoreHouseRefreshControl.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Class/CBStoreHouseRefreshControl.m b/Class/CBStoreHouseRefreshControl.m index 081f49c..83da51c 100644 --- a/Class/CBStoreHouseRefreshControl.m +++ b/Class/CBStoreHouseRefreshControl.m @@ -102,6 +102,7 @@ + (CBStoreHouseRefreshControl*)attachToScrollView:(UIScrollView *)scrollView if (startPoint.y > height) height = startPoint.y; if (endPoint.y > height) height = endPoint.y; } + height += lineWidth*0.5; refreshControl.frame = CGRectMake(0, 0, width, height); // Create bar items