Skip to content

Commit

Permalink
Merge pull request samvermette#110 from brokedi/patch-1
Browse files Browse the repository at this point in the history
Bugfix CGRect of titleFrame
  • Loading branch information
samvermette committed Feb 16, 2013
2 parents 71f06a8 + b36a9bc commit 764b88c
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions SVPullToRefresh/UIScrollView+SVPullToRefresh.m
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,7 @@ - (void)willMoveToSuperview:(UIView *)newSuperview {
}

- (void)layoutSubviews {
CGFloat remainingWidth = self.superview.bounds.size.width-200;
float position = 0.50;

CGRect titleFrame = self.titleLabel.frame;
titleFrame.origin.x = ceilf(remainingWidth*position+44);
titleFrame.origin.y = self.bounds.size.height-(self.subtitleLabel.text ? 48 : 40);
self.titleLabel.frame = titleFrame;

CGRect subtitleFrame = self.subtitleLabel.frame;
subtitleFrame.origin.x = titleFrame.origin.x;
subtitleFrame.origin.y = self.bounds.size.height-32;
self.subtitleLabel.frame = subtitleFrame;

CGRect arrowFrame = self.arrow.frame;
arrowFrame.origin.x = ceilf(remainingWidth*position);
self.arrow.frame = arrowFrame;

self.activityIndicatorView.center = self.arrow.center;

for(id otherView in self.viewForState) {
Expand All @@ -205,10 +189,6 @@ - (void)layoutSubviews {
self.arrow.hidden = hasCustomView;

if(hasCustomView) {
for (UIView *subview in self.subviews) {
[subview removeFromSuperview];
}

[self addSubview:customView];
CGRect viewBounds = [customView bounds];
CGPoint origin = CGPointMake(roundf((self.bounds.size.width-viewBounds.size.width)/2), roundf((self.bounds.size.height-viewBounds.size.height)/2));
Expand Down Expand Up @@ -238,6 +218,24 @@ - (void)layoutSubviews {
break;
}
}

CGFloat remainingWidth = self.superview.bounds.size.width-200;
float position = 0.50;

CGRect titleFrame = self.titleLabel.frame;
titleFrame.origin.x = ceilf(remainingWidth*position+44);
titleFrame.origin.y = self.bounds.size.height-(self.subtitleLabel.text ? 48 : 40);
self.titleLabel.frame = titleFrame;

CGRect subtitleFrame = self.subtitleLabel.frame;
subtitleFrame.origin.x = titleFrame.origin.x;
subtitleFrame.origin.y = self.bounds.size.height-32;
self.subtitleLabel.frame = subtitleFrame;

CGRect arrowFrame = self.arrow.frame;
arrowFrame.origin.x = ceilf(remainingWidth*position);
self.arrow.frame = arrowFrame;

}

#pragma mark - Scroll View
Expand Down

0 comments on commit 764b88c

Please sign in to comment.