如何在uitableview ios6.1中加載圖像。在tableview中加載圖像ios6.1
我目前使用SDWebImagehttps://github.com/rs/SDWebImage它工作。但有時它不會加載圖像。
有沒有其他的庫比我使用的庫更好?我是ios的初學者,這對我有很大的幫助。
在此先感謝。
這是我使用現在的代碼:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:MyIdentifier] autorelease];
}
// Here we use the new provided setImageWithURL: method to load the web image
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
cell.textLabel.text = @"My Text";
return cell;
}
代碼沒有問題,SDWebImage實際上是最受歡迎的庫之一。如果你不關心緩存,你可以嘗試AFNetworking。 '它不加載圖像'是什麼意思?你只是一直看到佔位符? – 2013-03-26 19:03:11
是的,我確實看到了,但我加載了50個圖像的itunes json feed,其中3個根本沒有加載。我必須退出/關閉應用程序並再次啓動應用程序才能看到它加載。 – 2013-03-26 19:28:40
再次感謝Sir .SO SDWebImage目前是最好的?我可以繼續嗎? – 2013-03-26 19:29:30