Permalink
Browse files

Better content view support

  • Loading branch information...
1 parent 2e110b5 commit f9c5c2684262a47342ea630b76d07f94235dbccf @soffes soffes committed Apr 10, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 SSPullToRefreshView.m
View
@@ -83,9 +83,7 @@ - (void)setContentView:(UIView<SSPullToRefreshContentView> *)contentView {
[_contentView removeFromSuperview];
_contentView = contentView;
- CGSize size = self.bounds.size;
- _contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
- _contentView.frame = CGRectMake(0.0f, size.height - _expandedHeight, size.width, _expandedHeight);
+ _contentView.autoresizingMask = UIViewAutoresizingNone;
[_contentView setState:_state withPullToRefreshView:self];
[self refreshLastUpdatedAt];
[self addSubview:_contentView];
@@ -108,12 +106,18 @@ - (void)removeFromSuperview {
}
+- (void)layoutSubviews {
+ CGSize size = self.bounds.size;
+ _contentView.frame = CGRectMake(0.0f, size.height - _expandedHeight, size.width, _expandedHeight);
+}
+
+
#pragma mark - Initializer
- (id)initWithScrollView:(UIScrollView *)scrollView delegate:(id<SSPullToRefreshViewDelegate>)delegate {
CGRect frame = CGRectMake(0.0f, 0.0f - scrollView.bounds.size.height, scrollView.bounds.size.width,
scrollView.bounds.size.height);
- if ((self = [super initWithFrame:frame])) {
+ if ((self = [self initWithFrame:frame])) {
self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.scrollView = scrollView;
self.delegate = delegate;

0 comments on commit f9c5c26

Please sign in to comment.