ios - 如何在 iOS 上制作嵌套表(多级部分)?
<p><p>数据结构如下代码:</p>
<pre><code>var list = [
"School A" : [
"Class A" : [
"student A",
"student B",
"student C"
],
"Class B" : [
"student A",
"student B",
"student C"
]
],
"School B" : [
"Class A" : [
"student A",
"student B",
"student C"
],
"Class B" : [
"student A",
"student B",
"student C"
]
]
]
</code></pre>
<p>我想用这样的 <code>UITableView</code> 来展示它:</p>
<pre><code>Section header : school
Section header : class
Student
...
Section header : class
Student
...
...
Section header : school
...
...
</code></pre>
<p>我希望 <code>Section header : school</code> 和 <code>Section header : class</code> 在滚动时都可以 float 在部分行之上。</p>
<p>如果没有办法这样做,是否有办法在一个 <code>Section header : class</code> 开始 float 时监听事件?然后我想在 float 类部分标题中添加学校名称。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我认为您可以使学校和类(class)都在 tableview 的部分标题(同一级别)上。不同之处在于学校的部分总是有 0 行,而类(class)部分的行是学生。棘手的部分是设置数据源。</p>
<blockquote>
<p>is there anyway to listen the event while one Section header : class start to float?Then I wanna add school name to the floating class section header.</p>
</blockquote>
<p><a href="https://stackoverflow.com/q/15204328/6543229" rel="noreferrer noopener nofollow">checking visible section</a> 我也做过类似的事情在屏幕的顶部。在 float 标题 TableView 中,当部分的任何部分可见时,标题始终可见,因此检查哪些部分可见就足以知道哪个标题可见。我在 tableview 的 <code>-scrollviewDidScroll</code> 委托(delegate)方法上不断检查它,除非你没有其他选择,否则我不会推荐它</p></p>
<p style="font-size: 20px;">关于ios - 如何在 iOS 上制作嵌套表(多级部分)?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/38342272/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/38342272/
</a>
</p>
页:
[1]