-1
我按照此tutorial。要在单元格添加到tableview中的代码看起来像这样toDoItems.append(ToDoItem(text: "CHILDS NAME"))
来自Firebase的桌面单元格
这是toDoItem
:
func toDoItemAddedAtIndex(index: Int) {
let toDoItem = ToDoItem(text: "")
toDoItems.insert(toDoItem, atIndex: index)
tableView.reloadData()
// enter edit mode
var editCell: TableViewCell
let visibleCells = tableView.visibleCells as! [TableViewCell]
for cell in visibleCells {
if (cell.toDoItem === toDoItem) {
editCell = cell
editCell.label.becomeFirstResponder()
break
}
}
}
这是ToDoItems
:
func tableView(tableView: UITableView,
cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! TableViewCell
cell.selectionStyle = .None
cell.textLabel?.backgroundColor = UIColor.clearColor()
let item = toDoItems[indexPath.row]
// cell.textLabel?.text = item.text
cell.delegate = self
cell.toDoItem = item
return cell
}
JSON:
"Mission-list" : {
"vJGnbbJX9lbBYwgesjHfNqdzmJs2" : {
}
}
问题:如何自动添加为每个孩子的tableview细胞加入波纹管任务列表?并将单元名称设置为子名称。
谢谢!
什么是* toDoItems *?将函数从Firebase中检索数据的位置还提供了* cellForIndexPath *中的一些相关代码。也将您的JSON结构作为文本而不是图像,它使导航更容易... – Dravidian