【发布时间】:2018-06-12 14:08:45
【问题描述】:
我几乎是 Swift 的新手。 In this URL我会得到一些元素;其中一个元素是 categoryList,它本身有两个元素。我将goodTypeName设置为表格的单元格标题,当按下一个单元格时,它需要发送goodType,它是数字(Int)以放置在下一个Url中。我尝试创建字典,但失败了!
UiTable 代码:::
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 {
if Global.GlobalVariable.names == []
{
self.DisplayMessage(UserMessage: "nothing is available ")
print("server is nil")
}
let cell = UITableViewCell()
let content = Global.GlobalVariable.names[indexPath.row]
cell.textLabel?.text = content
cell.accessoryType = .disclosureIndicator
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print(indexPath.item)
let next = self.storyboard?.instantiateViewController(withIdentifier: "SVC")
self.navigationController?.pushViewController(next!, animated: true)
}
My problem is not with populating them in a table, my problem is when a cell is selected , goodtype is needed to be sent to next page, becuase next page's url has to have the goodtype code.
【问题讨论】:
-
带有代码的描述具有误导性,添加您迄今为止尝试过的内容并详细说明
-
我更新了描述
标签: json swift uitableview dictionary