From 1c2167dee26a71eb1401a1c9c640ebd17268a275 Mon Sep 17 00:00:00 2001 From: alex1704 Date: Mon, 4 May 2015 05:46:00 +0300 Subject: [PATCH 1/4] [NSBundle mainBundle] changed to [NSBundle bundleForClass:self] in order to be able to find resource when embeded in framework --- Class/CBStoreHouseRefreshControl.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Class/CBStoreHouseRefreshControl.m b/Class/CBStoreHouseRefreshControl.m index f77dcf6..0404741 100644 --- a/Class/CBStoreHouseRefreshControl.m +++ b/Class/CBStoreHouseRefreshControl.m @@ -89,7 +89,7 @@ + (CBStoreHouseRefreshControl*)attachToScrollView:(UIScrollView *)scrollView // Calculate frame according to points max width and height CGFloat width = 0; CGFloat height = 0; - NSDictionary *rootDictionary = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:plist ofType:@"plist"]]; + NSDictionary *rootDictionary = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle bundleForClass:self] pathForResource:plist ofType:@"plist"]]; NSArray *startPoints = [rootDictionary objectForKey:startPointKey]; NSArray *endPoints = [rootDictionary objectForKey:endPointKey]; for (int i=0; i Date: Mon, 4 May 2015 05:54:26 +0300 Subject: [PATCH 2/4] dropHeight removed in scrollViewDidEndDragging when state == CBStoreHouseRefreshControlStateRefreshing because scroll view not scroll back (stays with offset) --- Class/CBStoreHouseRefreshControl.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Class/CBStoreHouseRefreshControl.m b/Class/CBStoreHouseRefreshControl.m index 0404741..04923f5 100644 --- a/Class/CBStoreHouseRefreshControl.m +++ b/Class/CBStoreHouseRefreshControl.m @@ -151,7 +151,7 @@ - (void)scrollViewDidEndDragging if (self.state == CBStoreHouseRefreshControlStateRefreshing) { UIEdgeInsets newInsets = self.scrollView.contentInset; - newInsets.top = self.originalTopContentInset + self.dropHeight; + newInsets.top = self.originalTopContentInset; CGPoint contentOffset = self.scrollView.contentOffset; [UIView animateWithDuration:0 animations:^(void) { From 1429f907f839fc2ff881733d07d1cfb2949f869c Mon Sep 17 00:00:00 2001 From: alex1704 Date: Tue, 5 May 2015 15:13:57 +0300 Subject: [PATCH 3/4] Position now dependant from scrollview center but not from screen center --- Class/CBStoreHouseRefreshControl.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Class/CBStoreHouseRefreshControl.m b/Class/CBStoreHouseRefreshControl.m index 04923f5..7bf0790 100644 --- a/Class/CBStoreHouseRefreshControl.m +++ b/Class/CBStoreHouseRefreshControl.m @@ -137,7 +137,7 @@ + (CBStoreHouseRefreshControl*)attachToScrollView:(UIScrollView *)scrollView - (void)scrollViewDidScroll { if (self.originalTopContentInset == 0) self.originalTopContentInset = self.scrollView.contentInset.top; - self.center = CGPointMake([UIScreen mainScreen].bounds.size.width/2, self.realContentOffsetY*krelativeHeightFactor); + self.center = CGPointMake(self.scrollView.frame.size.width * 0.5, self.realContentOffsetY*krelativeHeightFactor); if (self.state == CBStoreHouseRefreshControlStateIdle) [self updateBarItemsWithProgress:self.animationProgress]; } From c0727ea7395650b61f63b732d4aa8b204a91c7e3 Mon Sep 17 00:00:00 2001 From: alex1704 Date: Sun, 7 Jun 2015 02:12:35 +0300 Subject: [PATCH 4/4] Color update possibility added for BarItem --- Class/BarItem.h | 1 + Class/BarItem.m | 2 +- Class/CBStoreHouseRefreshControl.h | 2 ++ Class/CBStoreHouseRefreshControl.m | 9 +++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Class/BarItem.h b/Class/BarItem.h index 0c2d3de..80a3dc3 100644 --- a/Class/BarItem.h +++ b/Class/BarItem.h @@ -15,5 +15,6 @@ - (instancetype)initWithFrame:(CGRect)frame startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint color:(UIColor *)color lineWidth:(CGFloat)lineWidth; - (void)setupWithFrame:(CGRect)rect; - (void)setHorizontalRandomness:(int)horizontalRandomness dropHeight:(CGFloat)dropHeight; +@property (nonatomic) UIColor *color; @end diff --git a/Class/BarItem.m b/Class/BarItem.m index 0e7a57f..de6c48e 100644 --- a/Class/BarItem.m +++ b/Class/BarItem.m @@ -14,7 +14,7 @@ @interface BarItem () @property (nonatomic) CGFloat lineWidth; @property (nonatomic) CGPoint startPoint; @property (nonatomic) CGPoint endPoint; -@property (nonatomic) UIColor *color; + @end diff --git a/Class/CBStoreHouseRefreshControl.h b/Class/CBStoreHouseRefreshControl.h index 01692c9..cee5759 100644 --- a/Class/CBStoreHouseRefreshControl.h +++ b/Class/CBStoreHouseRefreshControl.h @@ -33,4 +33,6 @@ - (void)finishingLoading; +- (void)updateColor:(UIColor *)color; + @end diff --git a/Class/CBStoreHouseRefreshControl.m b/Class/CBStoreHouseRefreshControl.m index 7bf0790..fefcc38 100644 --- a/Class/CBStoreHouseRefreshControl.m +++ b/Class/CBStoreHouseRefreshControl.m @@ -132,6 +132,15 @@ + (CBStoreHouseRefreshControl*)attachToScrollView:(UIScrollView *)scrollView return refreshControl; } +- (void)updateColor:(UIColor *)color +{ + for (BarItem *barItem in self.barItems) { + barItem.color = color; + [barItem setNeedsDisplay]; + } +} + + #pragma mark UIScrollViewDelegate - (void)scrollViewDidScroll