Permalink
Browse files

Unregister before the scroll view is dealloc'ed.

Otherwise we get a nasty message and crash when the scroll view
goes away. Closes #16.
  • Loading branch information...
1 parent 06e26ff commit eaa3b55998e4cf9e823d9f58311876334400a750 @fernandonf fernandonf committed with ppaulojr Aug 15, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 ODRefreshControl/ODRefreshControl.m
@@ -94,6 +94,15 @@ - (void)dealloc
self.scrollView = nil;
}
+- (void)willMoveToSuperview:(UIView *)newSuperview
+{
+ [super willMoveToSuperview:newSuperview];
+ if (!newSuperview) {
+ [self.scrollView removeObserver:self forKeyPath:@"contentOffset"];
+ self.scrollView = nil;
+ }
+}
+
- (void)setTintColor:(UIColor *)tintColor
{
_tintColor = tintColor;

0 comments on commit eaa3b55

Please sign in to comment.