//创建一个队列
NSOperationQueue *operation=[[NSOperationQueue alloc]init];
//把任务放在NSBlockOperation里面
NSBlockOperation *myOperation=[NSBlockOperation blockOperationWithBlock:^{
NSData *firstData=[NSData dataWithContentsOfURL:[NSURL URLWithString:KURL1]]; dispatch_async(dispatch_get_main_queue(), ^{ _firstImageView.image=[UIImage imageWithData:firstData];
}); }]; //把第二任务添加到操作队列
[myOperation addExecutionBlock:^{
NSData *secondData=[NSData dataWithContentsOfURL:[NSURL URLWithString:KURL1]]; dispatch_async(dispatch_get_main_queue(), ^{ _secondImageView.image=[UIImage imageWithData:secondData];
}); }];
[operation addOperation:myOperation];