我正在使用SDWebImage將圖像加載到我的表格單元格中 - 但是,直到我選擇了該行,當我看到圖像顯示爲圖像時在屏幕上動畫。當我從導航控制器上點擊後,圖像就在那裏。使用SDWebImage將圖像加載到UITableView單元時出現的問題
這可能只是網絡速度問題還是我錯過了什麼?這是正在只是在一瞬間在模擬器上運行,如果有差別
代碼:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if(cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier] autorelease];
}
// Configure the cell...
NSUInteger row = [indexPath row];
// Here we use the new provided setImageWithURL: method to load the web image
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://mydomain.com/uploads/news1.png"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
cell.textLabel.text = [listData objectAtIndex:row];
return cell;
}
感謝
可能可能已經修復它 - 佔位符圖像文件名是一個錯字,它似乎現在工作。如果可以的話,我會將它標記爲已回答。 – Dave