Skip to content

Commit

Permalink
Merge remote-tracking branch 'parent/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
chourobin committed Jan 26, 2013
2 parents 6f244e3 + 59d0eb0 commit 19357a7
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions SVPullToRefresh/UIScrollView+SVPullToRefresh.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ - (void)layoutSubviews {

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 dateFrame = self.subtitleLabel.frame;
dateFrame.origin.x = titleFrame.origin.x;
self.subtitleLabel.frame = dateFrame;
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);
Expand Down Expand Up @@ -245,7 +247,7 @@ - (void)resetScrollViewContentInset {
- (void)setScrollViewContentInsetForLoading {
CGFloat offset = MAX(self.scrollView.contentOffset.y * -1, 0);
UIEdgeInsets currentInsets = self.scrollView.contentInset;
currentInsets.top = MIN(offset, self.originalTopInset + SVPullToRefreshViewHeight);
currentInsets.top = MIN(offset, self.originalTopInset + self.bounds.size.height);
[self setScrollViewContentInset:currentInsets];
}

Expand Down Expand Up @@ -280,7 +282,7 @@ - (void)scrollViewDidScroll:(CGPoint)contentOffset {
self.state = SVPullToRefreshStateStopped;
} else {
CGFloat offset = MAX(self.scrollView.contentOffset.y * -1, 0.0f);
offset = MIN(offset, self.originalTopInset + SVPullToRefreshViewHeight);
offset = MIN(offset, self.originalTopInset + self.bounds.size.height);
UIEdgeInsets contentInset = self.scrollView.contentInset;
self.scrollView.contentInset = UIEdgeInsetsMake(offset, contentInset.left, contentInset.bottom, contentInset.right);
}
Expand All @@ -290,7 +292,7 @@ - (void)scrollViewDidScroll:(CGPoint)contentOffset {

- (SVPullToRefreshArrow *)arrow {
if(!_arrow) {
_arrow = [[SVPullToRefreshArrow alloc]initWithFrame:CGRectMake(0, 6, 22, 48)];
_arrow = [[SVPullToRefreshArrow alloc]initWithFrame:CGRectMake(0, self.bounds.size.height-54, 22, 48)];
_arrow.backgroundColor = [UIColor clearColor];
[self addSubview:_arrow];
}
Expand All @@ -308,7 +310,7 @@ - (UIActivityIndicatorView *)activityIndicatorView {

- (UILabel *)titleLabel {
if(!_titleLabel) {
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, 210, 20)];
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 210, 20)];
_titleLabel.text = NSLocalizedString(@"Pull to refresh...",);
_titleLabel.font = [UIFont boldSystemFontOfSize:14];
_titleLabel.backgroundColor = [UIColor clearColor];
Expand All @@ -320,15 +322,11 @@ - (UILabel *)titleLabel {

- (UILabel *)subtitleLabel {
if(!_subtitleLabel) {
_subtitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 28, 210, 20)];
_subtitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 210, 20)];
_subtitleLabel.font = [UIFont systemFontOfSize:12];
_subtitleLabel.backgroundColor = [UIColor clearColor];
_subtitleLabel.textColor = textColor;
[self addSubview:_subtitleLabel];

CGRect titleFrame = self.titleLabel.frame;
titleFrame.origin.y = 12;
self.titleLabel.frame = titleFrame;
}
return _subtitleLabel;
}
Expand Down

0 comments on commit 19357a7

Please sign in to comment.