Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added cleanUp method to work around retain cycle

  • Loading branch information...
commit 1b8f03afc92fa682285a4f317fcda07b734928e7 1 parent a78ed8b
@thuss thuss authored
Showing with 18 additions and 4 deletions.
  1. +1 −0  PullToRefreshView.h
  2. +17 −4 PullToRefreshView.m
View
1  PullToRefreshView.h
@@ -73,6 +73,7 @@ typedef enum {
- (id)initWithWebView:(UIWebView *)webView;
- (id)initWithScrollView:(UIScrollView *)scroll atBottom:(BOOL)isBottom;
- (id)initWithWebView:(UIWebView *)webView atBottom:(BOOL)isBottom;
+- (void)cleanUp;
@end
View
21 PullToRefreshView.m
@@ -335,18 +335,31 @@ - (void)timerExpired:(NSTimer*)theTimer {
}
#pragma mark -
-#pragma mark Dealloc
+#pragma mark Cleanup
-- (void)dealloc {
+/**
+ * Since PTRV retains its parent scrollview you have to explicitly call cleanup to get it to release
+ */
+- (void)cleanUp {
+ delegate = nil;
+ [timer invalidate];
+ [timer release];
+ timer = nil;
[scrollView removeObserver:self forKeyPath:@"contentOffset"];
[scrollView removeObserver:self forKeyPath:@"contentSize"];
[scrollView release];
+ scrollView = nil;
+}
+
+#pragma mark -
+#pragma mark Dealloc
+
+- (void)dealloc {
+ [self cleanUp];
[arrowImage release];
[activityView release];
[statusLabel release];
[lastUpdatedLabel release];
- [timer invalidate];
- [timer release];
[pullToRefreshText release];
[releaseToRefreshText release];
[loadingText release];
Please sign in to comment.
Something went wrong with that request. Please try again.