Skip to content

@soffes /erg.m
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
@interface SSPullToRefreshView ()
@property (nonatomic, weak, readwrite) UIScrollView *scrollView;
@end
@implementation SSPullToRefreshView
@synthesize scrollView = _scrollView;
- (void)setScrollView:(UIScrollView *)scrollView {
void *context = (__bridge void *)self;
[self.scrollView removeObserver:self forKeyPath:@"contentOffset" context:context];
_scrollView = scrollView;
_defaultContentInset = self.scrollView.contentInset;
[self.scrollView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew context:context];
}
- (void)dealloc {
self.scrollView = nil;
}
- (void)removeFromSuperview {
// _scrollView is nil already when this is called so removing the KVO doesn't do anything
self.scrollView = nil;
[super removeFromSuperview];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.