xcode 如何将图像从 url 加载到 UITableViewCell?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13303008/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to load a image from url to UITableViewCell?
提问by IronManGill
I am new to iOS developer, using Storyboard
I get Image
from the URL and load an image to the UITableviewcellwhen scroll the tableview
the table will scroll very slowly and struck to scroll.
我是 iOS 开发人员的新手,使用Storyboard
我Image
从 URL获取并在滚动时将图像加载到UITableviewcelltableview
表格将非常缓慢地滚动并滚动。
回答by IronManGill
Here check ou the following links , you should use lazy loading for this,
在这里查看以下链接,您应该为此使用延迟加载,
Lazy load images in UITableView
Loading images from a URL into a UITableViewCell's UIImageView
将图像从 URL 加载到 UITableViewCell 的 UIImageView
Load image to a tableView from URL iphone sdk
将图像从 URL iphone sdk 加载到 tableView
回答by jithinroy
You should use lazy loading of image in your cells. The slowness or stuck is happening because you are fetching the image (..ie a network activity) in your main thread or the UI thread.
您应该在单元格中使用延迟加载图像。缓慢或卡住的发生是因为您正在主线程或 UI 线程中获取图像(..即网络活动)。
You can get a lot of tutorial in net for loading images async. Here is a tutorial from Apple : link
你可以在网络上获得很多关于异步加载图像的教程。这是来自 Apple 的教程:链接
回答by Paras Joshi
see the answer from this question for AsynchImage.. iphone-download-asynchronous
请参阅此问题的答案 AsynchImage .. iphone-download-asynchronous
also use AsynchImage for download image and set in UITableViewCell as a image
也使用 AsynchImage 下载图像并在 UITableViewCell 中设置为图像