【发布时间】:2018-04-09 13:26:13
【问题描述】:
我有一个 JSON
[
{
"image": "/images/Home.png",
"name": "Magazine2",
"clothe": [
{
"nameClothe": "dasdas",
"imageClothe": "sdvd"
}
]
},
{
"image": "/images/Home.png",
"name": "Magazine1",
"clothe": [
{
"nameClothe": "dasdass",
"imageClothe": "sregfd"
}
]
}
]
我有一个结构
struct HeroStats:Decodable {
let image: String
let name: String
let clothe: [SecondTable]?
}
struct SecondTable: Decodable {
let nameClothe: String
let imageClothe: String
}
在第一个 tableView 中,我看到“Magazine2”和“Magazine1”。在单击之前,在第一个 tableView 中,我想在第二个 tableView 中查看杂志的子元素,以便数据相关。例如-我点击"Magazine2",我可以看到"nameClothe"这个
"name": "Magazine2",
"clothe": [
{
"nameClothe": "dasdas",
"imageClothe": "sdvd"
}
]
我怎样才能创建这个?对不起我的英语...
【问题讨论】:
-
tableView(Magazine1、Magazine2)可以显示主要数据,但不能显示Magazine1和Magazine2的子数据。
-
你现在到底遇到了什么问题,你想在不同VoewController的不同TableVIew中显示你的孩子数据吗?
-
您的
Clothe数组数据是否正确填充?在Herostatestruct 里面。