Skip to content

Instantly share code, notes, and snippets.

@ikarius
Created July 27, 2011 12:18
Show Gist options
  • Save ikarius/1109234 to your computer and use it in GitHub Desktop.
Save ikarius/1109234 to your computer and use it in GitHub Desktop.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- (void) loadData {
dataLoaded = NO;
NSLog(@" thread launched");
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[self loadDataFromURL:nil];
dataLoaded = YES;
// reload de la tableview dans le thread principal:
[self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES];
// plutot que:
// [self.tableView reloadData];
[pool release];
}
// Et si tu veux éviter les pools, tu peux aussi utiliser les NSOperationQueue / NSOperation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment