【问题标题】:SWIFT: How to retrieve an array of strings from Firebase? [closed]SWIFT:如何从 Firebase 检索字符串数组? [关闭]
【发布时间】:2021-06-25 06:04:30
【问题描述】:

我有一个名称用 Firebase guestsOnTable 编写的数组:[“Joni”、“Mike”、“Will”、“Nicole”、“Tim”]。 我需要这个数组来检索并在 UITableView 中显示。在每一行中显示一个名称。 我是 Swift 新手,所以这是我第一次这样做。

【问题讨论】:

    标签: ios arrays swift tableview


    【解决方案1】:
    extension ViewController: UITableViewDataSource, UITableViewDelegate{
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
            return yourArray.count
        }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    yourLabel.text = yourArray[indexPath.row]
    }}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-21
      • 2017-06-27
      • 2023-03-05
      • 2019-08-06
      相关资源
      最近更新 更多