Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CBStoreHouseRefreshControl/ContentViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ @implementation ContentViewController

- (void)viewDidLoad {
[super viewDidLoad];

// self.edgesForExtendedLayout = UIRectEdgeNone;
self.title = @"Storehouse";
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
self.navigationController.navigationBar.barTintColor = [UIColor colorWithWhite:0.1 alpha:1];
Expand Down
14 changes: 9 additions & 5 deletions Class/CBStoreHouseRefreshControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ + (CBStoreHouseRefreshControl*)attachToScrollView:(UIScrollView *)scrollView
CGPoint startPoint = CGPointFromString(startPoints[i]);
CGPoint endPoint = CGPointFromString(endPoints[i]);

if (startPoint.x > width) width = startPoint.x;
if (endPoint.x > width) width = endPoint.x;
if (startPoint.y > height) height = startPoint.y;
if (endPoint.y > height) height = endPoint.y;
// shift it base on line width
if (startPoint.x + lineWidth > width) width = startPoint.x + lineWidth;
if (endPoint.x + lineWidth > width) width = endPoint.x + lineWidth;
if (startPoint.y + lineWidth > height) height = startPoint.y + lineWidth;
if (endPoint.y + lineWidth > height) height = endPoint.y + lineWidth;
}
refreshControl.frame = CGRectMake(0, 0, width, height);

Expand All @@ -110,6 +111,9 @@ + (CBStoreHouseRefreshControl*)attachToScrollView:(UIScrollView *)scrollView

CGPoint startPoint = CGPointFromString(startPoints[i]);
CGPoint endPoint = CGPointFromString(endPoints[i]);
// shift it base on line width
startPoint = CGPointMake(startPoint.x + lineWidth/2, startPoint.y + lineWidth/2);
endPoint = CGPointMake(endPoint.x + lineWidth/2, endPoint.y + lineWidth/2);

BarItem *barItem = [[BarItem alloc] initWithFrame:refreshControl.frame startPoint:startPoint endPoint:endPoint color:color lineWidth:lineWidth];
barItem.tag = i;
Expand All @@ -136,9 +140,9 @@ + (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);
if (self.state == CBStoreHouseRefreshControlStateIdle)
self.originalTopContentInset = self.scrollView.contentInset.top;
[self updateBarItemsWithProgress:self.animationProgress];
}

Expand Down