【发布时间】:2018-06-05 21:30:49
【问题描述】:
我几乎是 Swift 新手,作为一项自学,我正在使用从 API 接收到的一些 JSON 数据填充一个表格。每个单元格都有一个特定的名称,每当我按下每个单元格时,我都需要打开一个页面来显示它们将从 API 接收到的一些数据。
我应该为不同的单元格设计多个页面还是可以只有一个页面?
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return Global.GlobalVariable.names.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell()
let content = Global.GlobalVariable.names[indexPath.row]
cell.textLabel?.text = content
cell.accessoryType = .disclosureIndicator
return cell
}
我正在像这样填充每个单元格。
【问题讨论】:
标签: swift uitableview uiview