From 201e09fa863337c44b1a745d3a76825b4e49ff31 Mon Sep 17 00:00:00 2001 From: Joey Sacchini Date: Sat, 10 Dec 2011 22:15:56 -0500 Subject: [PATCH 1/2] Added multithreading to the table --- Classes/PullRefreshTableViewController.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Classes/PullRefreshTableViewController.m b/Classes/PullRefreshTableViewController.m index 85de5b9..b7c4370 100644 --- a/Classes/PullRefreshTableViewController.m +++ b/Classes/PullRefreshTableViewController.m @@ -171,9 +171,17 @@ - (void)stopLoadingComplete:(NSString *)animationID finished:(NSNumber *)finishe - (void)refresh { // This is just a demo. Override this method with your custom reload action. // Don't forget to call stopLoading at the end. - [self performSelector:@selector(stopLoading) withObject:nil afterDelay:2.0]; + [NSThread detachNewThreadSelector:@selector(refreshStep2) toTarget:self withObject:nil]; +} +- (void)refreshStep2 { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [self tablePullRefresh]; + [self performSelectorOnMainThread:@selector(stopLoading) withObject:nil waitUntilDone:YES]; + [pool release]; +} +- (void)tablePullRefresh { + sleep(2); } - - (void)dealloc { [refreshHeaderView release]; [refreshLabel release]; From 9021c795f73855dce54b2a06d397b5184183e8c7 Mon Sep 17 00:00:00 2001 From: Joey Sacchini Date: Sun, 11 Dec 2011 11:53:33 -0500 Subject: [PATCH 2/2] Fixed comment location --- Classes/PullRefreshTableViewController.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Classes/PullRefreshTableViewController.m b/Classes/PullRefreshTableViewController.m index b7c4370..6729083 100644 --- a/Classes/PullRefreshTableViewController.m +++ b/Classes/PullRefreshTableViewController.m @@ -169,8 +169,6 @@ - (void)stopLoadingComplete:(NSString *)animationID finished:(NSNumber *)finishe } - (void)refresh { - // This is just a demo. Override this method with your custom reload action. - // Don't forget to call stopLoading at the end. [NSThread detachNewThreadSelector:@selector(refreshStep2) toTarget:self withObject:nil]; } - (void)refreshStep2 { @@ -180,6 +178,7 @@ - (void)refreshStep2 { [pool release]; } - (void)tablePullRefresh { + // This is just a demo. Override this method with your custom reload action. sleep(2); } - (void)dealloc {