如何更改 STATIC UITableView 中 UITableViewSection 的页脚?

Bli*_*lip 5 objective-c uitableview ios swift

您知道如何在 iOS 的“设置”应用程序中,您可以从多个设置中选择一个设置,并且设置单元格所在的UITableView页脚将会发生变化。UITableViewSection就像当您访问应用程序的“允许位置访问”设置时一样,当您在“从不”、“使用应用程序时”或“始终”之间切换时,设置下方的文本会发生变化。在我的应用程序中,我想实现类似的功能。我尝试过 reloadSection: ,并且我已经实现了tableView:titleForFooterInSection:,但是当我调用reloadSection:它时,它完全隐藏了我的UITableViewSection。那么如何访问 a UITableViewSectionof a的页脚static UITableView并更改它而不隐藏整个内容呢?谢谢。

Leo*_*ica 4

覆盖表控制器tableView(titleForFooterInSection:)并添加逻辑以根据数据的状态选择字符串。当用户点击应更改页脚的单元格时,调用UITableView.reloadSections(withRowAnimation:)以平滑地更改页脚。