【问题标题】:Using Tableview to display items in descending order with childByAutoId使用 Tableview 以 childByAutoId 降序显示项目
【发布时间】:2016-06-14 19:09:50
【问题描述】:

我正在尝试在 firebaseUi TableView 中按 snap.key 以降序显示数据集

Firebase *firebaseRef = [[Firebase alloc] initWithUrl:@"firebaseio.com/data"];

    self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef cellReuseIdentifier:@"cell" view:self.tableView];

    [self.dataSource populateCellWithBlock:^(UITableViewCell *cell, FDataSnapshot *snap){
        // Populate cell as you see fit, like as below

        cell.textLabel.text = snap.value[@"Data"];


    }];

现在我的 TableView 看起来像这样:

  • 旧物品
  • 列表项
  • 新项目

我需要这样显示:

  • 新项目
  • 列表项
  • 旧物品

【问题讨论】:

  • 你的问题是什么?
  • snap.value[@"Data"] 会包含什么样的数据?????
  • 我已经更新了问题,基本上我需要通过 snap.key 对 tableview 进行排序,因为最新的项目在顶部。

标签: ios uitableview firebase firebaseui


【解决方案1】:

排序;无论是在服务器数据集上,还是在您检索参考之后和设置数据源之前。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-02-20
    • 1970-01-01
    • 2014-10-26
    • 2021-12-30
    • 1970-01-01
    相关资源
    最近更新 更多