ios - 滚动 Swift 4 时,Collectionview 上的图像混合在一起
问题描述
我在单元格视图上有一个带有图像的集合视图。但是当我向下滚动收藏视图时,我的一些图像是混合的。我没有使用任何库将图像插入 UIImageView。
这是我重用集合视图单元的代码。
cell.lvTitle.text = dataImage[indexPath.row]["nama"]
cell.delegate = self as! buttonClickedDelegate
cell.imageCode = dataImage[indexPath.row]["imageCode"]
cell.seq = dataImage[indexPath.row]["seq"]
cell.etcName = ""
if dataImage[indexPath.row]["tipe"] == "1" {
let data = NSData(contentsOf: NSURL(string: dataImage[indexPath.row]["image"]!)! as URL)
cell.imgFoto.image = UIImage(data: data! as Data)
}
if dataImage[indexPath.row]["tipe"] == "0"{
let data = Data(base64Encoded: dataImage[indexPath.row]["image"]!)
cell.imgFoto.image = UIImage(data: data!)
}
解决方案
推荐阅读
- javascript - 使用 ReactJS 下新订单时如何播放声音
- r - fread 没有正确读取列名
- javascript - 如何创建具有许多条的 charjs 条形图?
- python - 使用 selenium python 选择类
- java - 使用 Soot 分析 Java 程序
- javascript - 使用 csv 数据创建嵌入式消息 - nodeJS
- amazon-web-services - 有人可以解释 S3 存储桶隐私设置吗?
- python - 如何使用 python 保持 CMD 打开并在其上运行命令?
- git - composer.json 文件中作曲家私有存储库的身份验证
- xamarin - 单击 CollectionView 中的一行时,Xamarin Forms MVVM 显示图标/图像