菜鸟教程小白 发表于 2022-12-12 13:35:21

ios - 将多个图像异步加载到单个单元格


                                            <p><p>我在向 <code>TableView</code> 的每个单元格加载 5 张图像时遇到问题。我使用 <code>AFNetworking</code> 进行下载,使用 <code>setImageWithUrl</code> 方法进行 <code>imageView</code>:</p>

<pre><code>for (int i = 0; i &lt; urls.count; i++) {
    setImageWithURL:urls];
}
</code></pre>

<p><code>TableView</code> 滚动时非常刹车。但是当我尝试加载 1 或 2 滚动时没有刹车。
<img src="/image/yEcgH.png" alt="enter image description here"/>
如何在不刹车的情况下修正下载图片?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我认为下面的代码对你有帮助。</p>

<p>你第一次使用这个库 <a href="https://github.com/rs/SDWebImage" rel="noreferrer noopener nofollow">SDWebImage</a>
然后实现下面的代码。</p>

<pre><code>#import &lt;SDWebImage/UIImageView+WebCache.h&gt;
...

             placeholderImage:];
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 将多个图像异步加载到单个单元格,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/44962324/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/44962324/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 将多个图像异步加载到单个单元格