我正在尝试异步加载 tableViewCell 中的图像。 当我上下移动 table 时,图像就会出现,否则不会出现。
AsyncImageView 包含 NSUrlConnection。它不会进入委托(delegate)“connectionDidFinishLoading”内部。但是当我向上或向下移动表格时,它就会进入这个委托(delegate)函数
下面是代码
CGRect frame;
frame.size.width=115; frame.size.height=100;
frame.origin.x=0; frame.origin.y=0;
AsyncImageView* asyncImage = [[[AsyncImageView alloc]
initWithFrame:frame] autorelease];
loadingTable=[[UIActivityIndicatorView alloc] initWithFrame:frame];
[cell.contentView addSubview:loadingTable];
[loadingTable startAnimating];
asyncImage.tag = 999;
NSURL* url = [NSURL URLWithString:[[videoCollection objectAtIndex:indexPath.row] videoImageUrl] ];
[asyncImage loadImageFromURL:url activity:loadingTable];
[cell.contentView addSubview:asyncImage];
最佳答案
首先加载所有图像并向它们添加一些数据结构(例如数组),然后将其显示到表格中。不要将您的 UI 与网络调用重叠。
关于iphone - 异步图片加载错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10597520/