How to hide a section in UITableView?

前端 未结 12 2221
梦如初夏
梦如初夏 2020-12-05 00:32

There are some section in the table that does not contain any data and would like to hide that section.

How to do this?

12条回答
  •  悲哀的现实
    2020-12-05 01:00

    You can't "hide" a section as such, but you can "delete" it from the table view using the deleteSections:withRowAnimation: method. This will remove it from the view, with an optional animation, without affecting your backing data. (You should, however, update the data anyway so that the section doesn't reappear.)

    More info: UITableView class reference

提交回复
热议问题