Swift3:如何动态加载图片并将变量传递给第二个view controller?
Swift 3: How to load images dynamically and pass variables to the second view controller?
我正在尝试从 URL 加载图像以动态加载到 table 视图。我能够加载文本但需要加载图像。在我的外部数据库 table 中,我有 3 列(id、名称和图像)并且能够获取名称字段。图像字段包含文件的名称 (myimg.png)。我有一个 url (www.xyz.com.au/images/(image_name_from database.png)。所以当 table 加载时,每个单元格都应该显示缩略图图片和名称。当我们按下单元格转到另一个视图控制器时,与其关联的 ID 应该获取第二个视图控制器上的所有记录。
感谢您的帮助和提前时间:)
您需要使用图像加载器将图像加载到 UIImageView 中。我建议使用 KFSwiftImageLoader
let imageView : UIImageView!
imageView.loadImage(urlString: imageURL)
我正在尝试从 URL 加载图像以动态加载到 table 视图。我能够加载文本但需要加载图像。在我的外部数据库 table 中,我有 3 列(id、名称和图像)并且能够获取名称字段。图像字段包含文件的名称 (myimg.png)。我有一个 url (www.xyz.com.au/images/(image_name_from database.png)。所以当 table 加载时,每个单元格都应该显示缩略图图片和名称。当我们按下单元格转到另一个视图控制器时,与其关联的 ID 应该获取第二个视图控制器上的所有记录。
感谢您的帮助和提前时间:)
您需要使用图像加载器将图像加载到 UIImageView 中。我建议使用 KFSwiftImageLoader
let imageView : UIImageView!
imageView.loadImage(urlString: imageURL)