我有一個UITableView
,它從服務器上下載其UITableViewCell
的圖像。帶圖像的UITableview滾動非常緩慢
我發現表格滾動速度很慢。
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"parallaxCell";
JBParallaxCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSURL *imageURL = [NSURL URLWithString:[[news objectAtIndex:indexPath.row]objectForKey:@"Resim"]];
NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
UIImage *imageLoad = [[UIImage alloc] initWithData:imageData];
cell.titleLabel.text = [[news objectAtIndex:indexPath.row]objectForKey:@"Adi"];
cell.subtitleLabel.text = [[news objectAtIndex:indexPath.row]objectForKey:@"Resim"];
cell.parallaxImage.image = imageLoad;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
使用https://github.com/rs/SDWebImage懶懶地加載你的圖片。 – limon