我目前正在使用从 Facebook 加载用户墙提要的 UITableview。我遇到的问题是,放入 tableview 的图像加载正常,但是当用户滚动时,它们变成完全黑色。这是我的 cellForRow 方法:
if ([[objectTypes objectAtIndex:indexPath.row] isEqualToString:@"photo"]) {
//this is a picture
if ([facebookPictureObjectIDs objectAtIndex:indexPath.row])
{
if ([sourceArray objectAtIndex:indexPath.row]) {
if ([[sourceArray objectAtIndex:indexPath.row] rangeOfString:[facebookPictureObjectIDs objectAtIndex:indexPath.row]].location != NSNotFound) {
imageCell.imageview.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[sourceArray objectAtIndex:indexPath.row]]]];
NSLog(@"source array objectwith image ID: %@",[facebookPictureObjectIDs objectAtIndex:indexPath.row]);
}else {
NSLog(@"Same Image object id is: %@", [facebookPictureObjectIDs objectAtIndex:indexPath.row]);
}
} else {
NSLog(@"Source Array object NIL NIL NIL");
}
}else {
NSLog(@"Else Called");
}
[imageCell layoutSubviews];
returnCell = imageCell;
}
谢谢你的帮助 :)