【问题标题】:Get an array image from firebase从 firebase 获取数组图像
【发布时间】:2017-07-30 13:58:24
【问题描述】:

我想从 firebase 接收不同数量的 .gif 图像。我在tableView 中使用了collectionView。在 tableView 中我使用名称和地址,在 collectionView 中我使用图像。

所以我需要接收图像。例如:名字需要接收 image1 和 image2。在第二个名称上 - image1、image2、image3、image4、image5 等等作为下一个名称。请检查我的源代码和firebase。

【问题讨论】:

标签: ios swift uitableview firebase uicollectionview


【解决方案1】:

在 firebase 中,要接收数组,键应该是零索引的序号,如下所示:

-photos
    -0: "https://firebasestorage.googleapis..."
    -1: "https://firebasestorage.googleapis..."
    -2: "https://firebasestorage.googleapis..."

这样,在从 firebase 检索数据时,您可以为每个名称拥有动态长度的图像数组。

然而,你这样做的方式会给你一个图像字典,你需要使用它来遍历

Array(dict.keys) // for Dictionary

dict.allKeys // for NSDictionary

【讨论】:

    猜你喜欢
    • 2021-07-08
    • 2019-08-03
    • 2017-12-29
    • 1970-01-01
    • 2011-09-25
    • 2020-04-23
    • 2019-10-07
    相关资源
    最近更新 更多