Permalink
Browse files

Retain the scrollView so that it doesn't get de-alloc'd before the pu…

…lltorefreshview
  • Loading branch information...
1 parent 4339a36 commit 02668174ca23aab4e6cccb8d28f15ef8794bf413 @thuss thuss committed Dec 21, 2011
Showing with 5 additions and 4 deletions.
  1. +1 −1 PullToRefreshView.h
  2. +4 −3 PullToRefreshView.m
View
2 PullToRefreshView.h
@@ -50,7 +50,7 @@ typedef enum {
UIActivityIndicatorView *activityView;
}
-@property (nonatomic, readonly) UIScrollView *scrollView;
+@property (nonatomic, retain) UIScrollView *scrollView;
@property (nonatomic, assign) id<PullToRefreshViewDelegate> delegate;
@property (nonatomic, assign) NSTimeInterval timeout;
@property (nonatomic, retain) UILabel *lastUpdatedLabel;
View
7 PullToRefreshView.m
@@ -42,7 +42,8 @@ - (void)dismissView;
@end
@implementation PullToRefreshView
-@synthesize delegate, scrollView;
+@synthesize delegate;
+@synthesize scrollView;
@synthesize lastUpdatedLabel, statusLabel, arrowImage, activityView;
@synthesize timeout;
@@ -67,7 +68,7 @@ - (id)initWithScrollView:(UIScrollView *)scroll {
CGRect frame = CGRectMake(0.0f, 0.0f - scroll.bounds.size.height, scroll.bounds.size.width, scroll.bounds.size.height);
if ((self = [super initWithFrame:frame])) {
- scrollView = scroll;
+ self.scrollView = scroll;
[scrollView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew context:NULL];
self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
@@ -240,7 +241,7 @@ - (void)timerExpired:(NSTimer*)theTimer {
- (void)dealloc {
[scrollView removeObserver:self forKeyPath:@"contentOffset"];
-
+ [scrollView release];
[arrowImage release];
[activityView release];
[statusLabel release];

0 comments on commit 0266817

Please sign in to comment.