ios - 如何在 IGListKit 中添加 sectionHeader,如 tableview header

标签 ios swift

IGListKit 库链接:https://github.com/Instagram/IGListKit

我正在使用 IGListKit 制作不同的截面单元格。我成功地完成了这项任务,但我无法使用 iglistKit 为不同的部分添加标题

最佳答案

从 IGListKit 2.1 开始,考虑以 IG 为前缀的类和协议(protocol)名称。从 3.0 开始删除了此前缀。

在您的部分 Controller 类中,除了从 IGListSectionController 继承(并在 IGListKit 2.x 上实现 IGListSectionType)之外,您还需要实现 IGListSupplementaryViewSource 并设置为您的部分 Controller self.supplementaryViewSource = self

您可能需要查看 IGListKit 官方示例中的类 FeedItemSectionController .

当然,您也可以在单独的实体中实现此协议(protocol),但实际上 IGListKit was not designed for that .我的团队能够通过在部分 Controller 将它的一些数据注入(inject)到这个单独的 IGListSupplementaryViewSource 实现器中的方式中增加一些复杂性来做到这一点。

关于ios - 如何在 IGListKit 中添加 sectionHeader,如 tableview header,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44254506/

相关文章:

ios - 在 iOS 中验证文本域

ios - 检查数字的 UITextfield 间隔

html - 实现 Scrollview 委托(delegate)方法时,WKWebview Scroll 变得缓慢和滞后

swift - 是否有调用函数的 SKAction?

objective-c - iOS - 努力在 Obj-C/Swift 代码之间转换

ios - 在ios swift中实现地址搜索

ios - UICollectionViewCell 在 UICollectionViewReusableView 宽度之后启动

ios - "' isDeveloperModeEnabled ' is deprecated: This no longer needs to be set during development. "isDeveloperModeEnabled 用于什么

ios - TableView (内部 View Controller )Segue 不起作用

swift - 在 macOS 中使用 swift 实现文档拖拽到应用程序