Skip to content
Browse files

Updated PTR so it doesn't retain its scrollView

  • Loading branch information...
1 parent 1b8f03a commit 1773b24146ecda88a6a9c571ee68db28e21b50c8 @thuss thuss committed Sep 24, 2012
Showing with 5 additions and 7 deletions.
  1. +1 −2 PullToRefreshView.h
  2. +4 −5 PullToRefreshView.m
View
3 PullToRefreshView.h
@@ -52,7 +52,7 @@ typedef enum {
NSDateFormatter *dateFormatter;
}
-@property (nonatomic, retain) UIScrollView *scrollView;
+@property (nonatomic, assign) UIScrollView *scrollView;
@property (nonatomic, assign) id<PullToRefreshViewDelegate> delegate;
@property (nonatomic, assign) NSTimeInterval timeout;
@property (nonatomic, retain) UILabel *lastUpdatedLabel;
@@ -73,7 +73,6 @@ typedef enum {
- (id)initWithWebView:(UIWebView *)webView;
- (id)initWithScrollView:(UIScrollView *)scroll atBottom:(BOOL)isBottom;
- (id)initWithWebView:(UIWebView *)webView atBottom:(BOOL)isBottom;
-- (void)cleanUp;
@end
View
9 PullToRefreshView.m
@@ -335,27 +335,26 @@ - (void)timerExpired:(NSTimer*)theTimer {
}
#pragma mark -
-#pragma mark Cleanup
+#pragma mark Lifecycle
/**
* Since PTRV retains its parent scrollview you have to explicitly call cleanup to get it to release
*/
-- (void)cleanUp {
- delegate = nil;
+-(void)removeFromSuperview {
+ [super removeFromSuperview];
+ 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];

0 comments on commit 1773b24

Please sign in to comment.
Something went wrong with that request. Please try again.