Created
July 27, 2011 12:18
-
-
Save ikarius/1109234 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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