Skip to content

Commit

Permalink
Fixed wrong size. Closes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Friend-LGA committed Dec 1, 2015
1 parent 86ffb98 commit a9e20b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion LGRefreshView.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'LGRefreshView'
s.version = '1.0.4'
s.version = '1.0.5'
s.platform = :ios, '6.0'
s.license = 'MIT'
s.homepage = 'https://github.com/Friend-LGA/LGRefreshView'
Expand Down
10 changes: 5 additions & 5 deletions LGRefreshView/LGRefreshView.m
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ - (void)addObservers

[_scrollView addObserver:self forKeyPath:@"contentInset" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionPrior context:nil];
[_scrollView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew context:nil];
[_scrollView addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew context:nil];
[_scrollView addObserver:self forKeyPath:@"bounds" options:NSKeyValueObservingOptionNew context:nil];
}
}

Expand All @@ -426,15 +426,15 @@ - (void)removeObservers

[_scrollView removeObserver:self forKeyPath:@"contentInset"];
[_scrollView removeObserver:self forKeyPath:@"contentOffset"];
[_scrollView removeObserver:self forKeyPath:@"frame"];
[_scrollView removeObserver:self forKeyPath:@"bounds"];
}
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([keyPath isEqualToString:@"frame"])
if ([keyPath isEqualToString:@"bounds"])
{
if (self.frame.size.width != _scrollView.frame.size.width)
if (self.bounds.size.width != _scrollView.bounds.size.width)
{
[self layoutInvalidate];

Expand All @@ -445,7 +445,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
[self restoreDefaultState];

UIEdgeInsets contentInset = _scrollView.contentInset;
contentInset.top -= self.frame.size.height;
contentInset.top -= self.bounds.size.height;
_scrollView.contentInset = contentInset;

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^(void)
Expand Down

0 comments on commit a9e20b1

Please sign in to comment.