Permalink
Browse files

Added -dealloc and added target and selector

  • Loading branch information...
1 parent 749fbe5 commit 17e326519b049a28dc571c8c24fb3fe087bb71ce @alexzielenski committed Nov 15, 2011
Showing with 18 additions and 1 deletion.
  1. +6 −0 ScrollToRefresh/src/EQSTRScrollView.h
  2. +12 −1 ScrollToRefresh/src/EQSTRScrollView.m
@@ -32,7 +32,13 @@
NSView *refreshHeader;
NSView *refreshArrow;
YRKSpinningProgressIndicator *refreshSpinner;
+
+ id target;
+ SEL selector;
}
+@property (assign) id target;
+@property (assign) SEL selector;
+
@property (readonly) BOOL isRefreshing;
@property (readonly) NSView *refreshHeader;
- (void)startLoading;
@@ -31,7 +31,13 @@
// code modeled from https://github.com/leah/PullToRefresh/blob/master/Classes/PullRefreshTableViewController.m
@implementation EQSTRScrollView
-@synthesize isRefreshing, refreshHeader;
+@synthesize isRefreshing, refreshHeader, target, selector;
+- (void)dealloc {
+ [refreshHeader release];
+ [refreshArrow release];
+ [refreshSpinner release];
+ [super dealloc];
+}
- (void)viewDidMoveToWindow {
[self createHeaderView];
}
@@ -140,6 +146,11 @@ - (void)startLoading {
refreshArrow.hidden = YES;
[refreshSpinner startAnimation:self];
+
+ if (self.target)
+ [self.target performSelectorOnMainThread:self.selector
+ withObject:self
+ waitUntilDone:YES];
}
- (void)stopLoading {
refreshArrow.hidden = NO;

0 comments on commit 17e3265

Please sign in to comment.