GrandCentralDispatch & Blocks

GCD helps improve your apps performance and responsiveness by outsourcing processes that require a lot or computing power to the background while keeping your UI responsive.  Normally you might want to do some heavy lifting. Let’s create an Empty Application.  You need to declare a IBOutlet UIImageView *imageView ivar in your appDelegate, make it a property and synthesize it in .m and make the connection in Interface Builder, IB.  In it’s viewDidLoad method put the following code: // Download the image NSURL *url = [NSURL URLWithString:@””]; NSURLRequest *req = [NSURLRequest requestWithURL:url]; NSURLResponse *res = [[NSURLResponse alloc] init]; NSError *err = nil; NSData *data = nil; data = [NSURLConnection sendSynchronousRequest:req returningResponse:&res… Read More

Continue Reading