我想在iOS中创建具有子菜单内容的菜单结构。我从以下字典中获取:
{
"post_Type": "subject",
"head": "Edho",
"abbreviation": "histophya”,
"title": "Edho",
"body": "Edho",
"Tree": [{
"post_Type": "topic",
"head": "Edho/teaologie",
"title": "<span>teaologie</span>",
"body": "teaologie"
}, {
"post_Type": "topic",
"head": "Edho/abcedf",
"title": "<span>abcedf</span>",
"body": "abcedf"
}, {
"post_Type": "topic",
"head": "Edho/his+food+system+and+blut",
"title": "<span>his-food-system-and-Blut</span>",
"body": "his food system+and+blut"
}, {
"post_Type": "topic",
"head": "Edho/Lump+abcedf+and+immunsystem",
"title": "<span>Lump abcedf and Immunsystem</span>",
"body": "Lump+abcedf+and+immunsystem"
}, {
"post_Type": "topic",
"head": "Edho/rationsystem",
"title": "<span>rationsystem</span>",
"body": "rationsystem"
}, {
"post_Type": "topic",
"head": "Edho/varadha",
"title": "<span>varadha</span>",
"body": "varadha",
"Tree": [{
"post_Type": "topic",
"head": "Edho/varadha/grand",
"title": "<span>grand</span>",
"body": "grand"
}, {
"post_Type": "topic",
"head": "Edho/varadha/mand+and+rachen",
"title": "<span>mand and Rachen</span>",
"body": "mand+and+rachen",
"Tree": [{
"post_Type": "module",
"head": "Edho/pen+wan+men+Edho",
"title": "<span>pen, wan, men: Edho</span>",
"body": "pen+wan+men+Edho"
}, {
"post_Type": "module",
"head": "Edho/zun+Edho",
"title": "<span>zun: Edho</span>",
"body": "zun+Edho",
"TreeContent": [{
"id": "Preview",
"title": "Preview"
}, {
"id": "n67adf05c9007ba58",
"title": "<span>Mark and Milk Abu</span>"
}]
}, {
"post_Type": "module",
"head": "Edho/zahne+Edho",
"title": "<span>zahne: Edho</span>",
"body": "zahne+Edho"
}]
}, {
"post_Type": "topic",
"head": "Edho/varadha/vada",
"title": "<span>vada</span>",
"body": "vada"
}, {
"post_Type": "topic",
"head": "Edho/varadha/poda",
"title": "<span>poda</span>",
"body": "poda"
}]
}, {
"post_Type": "topic",
"head": "Edho/end+orange",
"title": "<span>end orange</span>",
"body": "end+orange"
}, {
"post_Type": "topic",
"head": "Edho/horonorange",
"title": "<span>horonorange</span>",
"body": "horonorange"
}, {
"post_Type": "topic",
"head": "Edho/techtsorange",
"title": "<span>techtsorange</span>",
"body": "techtsorange"
}, {
"post_Type": "topic",
"head": "Edho/hat",
"title": "<span>hat</span>",
"body": "hat"
}, {
"post_Type": "topic",
"head": "Edho/system+and+sign",
"title": "<span>system and sign</span>",
"body": "system+and+sign"
}, {
"post_Type": "topic",
"head": "Edho/hot chips",
"title": "<span>hot chips</span>",
"body": "hot chips"
}]
}
答案 0 :(得分:1)
使用RATreeView,它是树结构的最佳窗格:http://cocoadocs.org/docsets/RATreeView/0.2.2/
RATreeView是一个旨在支持在IOS上实现树视图的类。它作为UITableView的包装器,定义自己的委托和数据源方法,以便更轻松地管理树数据结构。
由于RATreeView是UITableView的包装器,因此大多数委托和数据源方法只是UITableView委托和数据源协议的特定方法的等价物。它们改变了它们为树结构提供更容易管理的方式。协议中还有一些新方法可以支持扩展和折叠树视图的行。它应该适用于IOS 5.0 +。