iphone - 异步图片加载错误

标签 iphone ios

我正在尝试异步加载 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/

相关文章:

ios - 无法在 iOS11.3 中的 WKWebView POST 请求上设置 httpBody

iphone - 原生iPhone数据库,iPhone上的所有数据

iphone - 将一个 AAC 文件附加到另一个文件时的输出音频设置

iOS 文本不会立即更新 - Swift

ios - 在 ScrollView 中的 ImageView 上使用 GestureRecognizer

ios pod 安装 gcm

iphone - 解析 RSS 提要 - 检索图像、URL?

iOS - 链接具有比我的项目更高的部署目标的框架

iphone - 面向方面的 Objective-C 库?

iphone - 图表在iphone app中的实现