Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*!
- @method
- @abstract downloads images, this is the method that dispatches tasks in the operation queue
- */
- - (void) loadImage:(id)arg
- {
- NSLog(@"AsyncImageLoadingViewController::loadImage called");
- if ((arg == nil) || ([arg isKindOfClass:[NSString class]] == NO)) {
- return;
- }
- // create a local autorelease pool since this code runs not on main thread
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- // fetch the image
- NSLog(@"AsyncImageLoadingViewController::loadImage - will download image: %@", arg);
- NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:arg]];
- UIImage *image = [UIImage imageWithData:data];
- // update tableview with the downloaded image on main thread
- [self performSelectorOnMainThread:@selector(updateTableView:) withObject:[image retain] waitUntilDone:NO];
- [pool release];
- }
Add Comment
Please, Sign In to add comment