http://blog.sina.com.cn/s/blog_4adf31ea0100o3f6.html
使用NSOperationQueue(或ASINetWorkQueue,见下面示例)将给你对异步request更多的控制。当使用队列的时候,只有确定数量的request可以同时运行。如果你添加的request超过了队列的maxConcurrentOperationCo
注:ASINetworkQueue 类查看前面的IPhone之ASIHTTPRequest简介
ASINetworkQueue for (ForumItem *item in itemList) //item.Image if (item.Image) { ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURLURLWithString:item.Image]]; request.userInfo = [NSDictionary dictionaryWithObject:item.ImageforKey:@"Image"]; [request setDelegate:self]; [request setDidFinishSelector:@selector(requestDidFinished:)]; [queue addOperation:request]; } } [queue go]; 最后记的释放 |