直接使用这样
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[dictionary objectForKey:@"image"]]]];
它采用主线程,所以你不能滚动befor下载您Image.So你加NSURLConnectionDataDelegate,NSURLConnectionDelegate通过
插入添加此协议,并下载图像这些代码行您想要下载您的图像
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
NSURLConnection *connection = [NSURLConnection connectionWithRequest:request delegate:self];
received_data = [[NSMutableData alloc]init];
[connection start];
这些行触发这些委托下载数据。
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
[received_data setLength:0];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[received_data appendData:data];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
//Use your download image
imageView.image = [UIImage imageWithData:received_data];
}
您应该使用dequeueReusableCellWithIdentifier: – rocky 2013-05-13 21:03:41
我没有,但我并没有把它写入上述代码,我编辑我的代码的方式 – 2013-05-13 21:08:16