sdwebimage - 如何在不快速下载的情况下从图像 url 获取图像大小
问题描述
我需要来自 URL 的图像大小,当我在 UITableView 单元格中从 URL 设置图像时,我需要一个 UIImage 框架,以便我可以相应地设置 UIImageView 框架大小。我正在使用下面的代码
cell.imgPostedImage.sd_setImage(with: URL(string: imageArray[0]),placeholderImage: UIImage(named: "placeholder"),options:
SDWebImageOptions(rawValue: 0), completed: { (image, error, cacheType,imageURL) in
print(image?.size.height)
cell.imgPostedImage.setNeedsLayout()
})
解决方案
推荐阅读
- javascript - client.catch 不是一个函数,并且角色不断制作“新角色”而不是我指定的名称?
- javascript - 如何使用 PHP 偏移 HTML 表格以从不同列的第二行单元格值中减去第一行的单元格值
- mysql - 获取 2 个表格中的最后 5 个帖子
- rally - 时间表报告生成
- android - 视图已添加到窗口管理器
- python - 两个 Flask 应用程序之间的 POST 请求 - 前端到后端
- mysql - 检查长时间运行查询的状态
- adaptive-cards - 不允许使用目标 URL 方案 XXX
- tsql - 为什么我的查询提交错误?
- dart - 停靠在底部应用栏时如何在 FAB 上更改填充?