删除tableview节标题视图 [英] Delete tableview section header view

查看:45
本文介绍了删除tableview节标题视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含3个部分/3个海关部分标题视图的表格视图...

I have a tableview with 3 sections / 3 customs section header view...

在我删除此部分之一的行后,如果该部分为空,则如何删除该部分的标题视图.

After I delete a row in one of this section and if the section come empty, how I can delete the section header view.

谢谢

推荐答案

方法之一是维护有关节是否已为空的标志,并为该节的页眉和页脚返回零高度,然后执行reloadSections:withRowAnimation:当节中的唯一行被删除时.

One of the approaches could be to maintain flags as to whether the section has become empty and return zero height for that section's header and footer and then execute reloadSections:withRowAnimation: when the only row in section is deleted.

当您具有特定于节的自定义项时,如果要从模型中删除该节将变得棘手,这无疑会更好.如果没有这样的自定义设置,则可以继续维护一个数组数组.一旦清空行数组,就可以从sections数组中丢弃该节.这将反映在 reloadData 上.

This is certainly better when you have section specific customizations which would become tricky to handle if we were to remove the section from our model. If there are no customizations as such, you could go about maintaining an array of arrays. Once the row array is emptied, you can discard the section from the sections array. This will reflect on reloadData.

在任何一种情况下,您都需要影响模型以更改视图.

In either case, you will need to affect the model to change the view.

这篇关于删除tableview节标题视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆