[英]How to know when a collection view outline has been expanded?
I am using an outline view style UICollectionView
setup and setting up my header cells like so:我正在使用大纲视图样式
UICollectionView
设置并设置我的 header 单元格,如下所示:
var content = cell.defaultContentConfiguration()
content.text = brand.name ?? "Unknown"
cell.contentConfiguration = content
let headerDisclosureOption = UICellAccessory.OutlineDisclosureOptions(style: .header)
cell.accessories = [.outlineDisclosure(options: headerDisclosureOption)]
However is it possible to receive something like a delegate call whenever a cell section is expanded?但是,每当展开单元格部分时,是否有可能收到类似委托调用的内容? I would like to pull fresh data from the inte.net whenever a list is expanded.
每当扩展列表时,我都想从 inte.net 中提取新数据。
Use the diffable data source's sectionSnapshotHandlers
property.使用 diffable 数据源的
sectionSnapshotHandlers
属性。 It is a SectionSnapshotHandlers instance, a struct consisting entirely of properties whose values are functions.它是一个 SectionSnapshotHandlers 实例,一个完全由值为函数的属性组成的结构。 Those functions, which you assign, are your callbacks.
您分配的那些功能是您的回调。
See https://developer.apple.com/documentation/uikit/uicollectionviewdiffabledatasource/3600966-sectionsnapshothandlers请参阅https://developer.apple.com/documentation/uikit/uicollectionviewdiffabledatasource/3600966-sectionsnapshothandlers
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.