Notes from Bordertown Labs with posts regarding software development for the iPhone, Ruby on Rails, tips and code.
» Contact with inquiries.
Visualize your geodata in augmented reality with 3DAR by Spot Metrix. |
(via How to Check-In Using the Facebook iOS SDK and Graph API | Tyler White Design)
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
NSURL *url = [NSURL URLWithString:@"http://bit.ly/nUX01h"];
NSURLRequest *req = [NSURLRequest requestWithURL:url];
[NSURLConnection sendAsynchronousRequest:req
queue:[NSOperationQueue currentQueue]
completionHandler:
^(NSURLResponse *res, NSData *data, NSError *err) {
// Convert the data to a UIImage
UIImage *image = [UIImage imageWithData:data];
// Scale the image
UIImage *thumbImage = nil;
CGSize newSize = CGSizeMake(90, (90 / image.size.width) * image.size.height);
UIGraphicsBeginImageContext(newSize);
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
thumbImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
dispatch_async(dispatch_get_main_queue(), ^{
self.imageView.image = thumbImage;
});
}];
});
Let’s say your UITableViewController implements the NSFetchedResultsControllerDelegate. When you add, remove or change Core Data objects in your context, you’d expect the table view to update, right? Make sure you include the following code in your controller.
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
[self.tableView reloadData];
}