diff --git a/Classes/PullRefreshTableViewController.m b/Classes/PullRefreshTableViewController.m index 85de5b9..6729083 100644 --- a/Classes/PullRefreshTableViewController.m +++ b/Classes/PullRefreshTableViewController.m @@ -169,11 +169,18 @@ - (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 { + // This is just a demo. Override this method with your custom reload action. + sleep(2); } - - (void)dealloc { [refreshHeaderView release]; [refreshLabel release];