【发布时间】:2016-06-11 02:29:02
【问题描述】:
我已经开发了 6 个月的游戏,但遇到了一个我似乎无法解决的问题。有一些类似的问题,但没有一个完全适合我的情况。
总结
我的游戏有 200 个项目。每个项目都有一个显示实际项目的未锁定图像和一个仅显示其灰色的锁定图像。我将把所有 200 张未锁定图像和大约 15 张锁定图像放入 Firebase 存储中(因为每个项目都有大约 15 个皮肤,所以基础始终相同)。
问题
StoreViewController 页面是一个 UIViewController,其中嵌入了一个 CollectionView。创建CollectionViewTableCells 时,每个单元格都有UIImageView。每个单元格都像这样迭代一个字典数组(通常这个数组将有 150 多个字典):
let items : [[String:String]] = [
[
"type" : "star",
"model" : "blackOne",
"available" : "no",
"rarity" : "normal",
"totalOwned" : "1",
"price" : "9,999",
"u-image" : "blackone-u",
"l-image" : "star-l"
],
[
"type" : "star",
"model" : "blackTwo",
"available" : "no",
"rarity" : "normal",
"totalOwned" : "1",
"price" : "10,500",
"u-image" : "blacktwo-u",
"l-image" : "star-l"
],
[
"type" : "square",
"model" : "black-New",
"available" : "no",
"rarity" : "normal",
"totalOwned" : "1",
"price" : "12,950",
"u-image" : "blacknew-u",
"l-image" : "square-l"
]
]
u-image & l-image 包含该项目的相应图像的名称。上传到 Firebase 存储的相同图片。
问题
我应该如何使用u-image & l-image 来获取 Firebase 存储并在每个UICollectionViewCell's UIImage 中显示正确的图像?每次用户访问StoreViewController 时,我都需要抓取大约 200 张图片来显示。
【问题讨论】: