gpt4 book ai didi

ios - 使用动态字典创建可扩展 TableView

转载 作者:行者123 更新时间:2023-11-29 00:32:56 27 4
gpt4 key购买 nike

我想在 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"
}]
}

最佳答案

使用 RATreeView,它是树结构的最佳 pod:http://cocoadocs.org/docsets/RATreeView/0.2.2/

RATreeView 是一个旨在支持在 IOS 上实现 TreeView 的类。它用作 UITableView 的包装器,定义自己的委托(delegate)和数据源方法,以便更轻松地管理树数据结构。

由于 RATreeView 是 UITableView 的包装器,因此大多数委托(delegate)和数据源方法只是 UITableView 委托(delegate)和数据源协议(protocol)的特定方法的等价物。它们在为树结构提供更容易管理的方式上发生了变化。协议(protocol)中也有一些新方法来支持展开和折叠 TreeView 的行。它应该适用于 IOS 5.0+。

关于ios - 使用动态字典创建可扩展 TableView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41296245/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com