【发布时间】:2020-02-05 10:06:18
【问题描述】:
我的Assets.xcassets 文件夹中有以下文件夹
screenshot of the error - sorry, i dont have enough rep to show the image
我正在尝试访问ca 文件夹,然后是payments,然后是里面的图像以填充UICollectionViewCell。为了测试,我强制拆开它(我知道它不安全):
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CellId, for: indexPath) as! MyCollectionViewCell
cell.paymentImageView.image = UIImage(named: "logos/ca/payments/x.png")!
return cell
我遇到了崩溃,上面写着:
致命错误:在展开可选值时意外发现 nil:文件
我不确定它为什么会崩溃,文件在那里。对于每个国家/地区的不同文件夹中都有多个重复的文件名,这是一个问题吗?即 xyz.png 也可能在 ca/payments 和 de/payments 中
【问题讨论】:
-
尝试删除路径
logos/ca/payments/只放imageName.png
标签: ios swift uicollectionview uicollectionviewcell