简体   繁体   English

如何知道集合视图大纲何时展开?

[英]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.

相关问题 SwiftUI - 我如何知道何时单击了导航视图的后退按钮? - SwiftUI - How do I know when the back button of a navigation view has been clicked? 如何知道Firebase DataSnapshot何时已在服务器端保留 - How to know when Firebase DataSnapshot has been persisted server side IOS swift如何知道activityViewController何时成功使用 - IOS swift how to know when activityViewController has been successfully used 扩展UICollectionView中的单元格时调整图像大小 - Resizing an image when the cell in a UICollectionView has been expanded 模态视图控制器被关闭后如何调用函数 - How to call a function when a Modal View Controller has been dismissed 有没有办法知道视图是否已经加载到 SwiftUI - Is there a way to know if a view has already been loaded in SwiftUI 当拥有两个tableview部分时,如何知道选择了哪一行? - How to know which row has been selected when having two sections of the tableview? 检测何时显示(重新)显示视图 - Detect when the View has been (re)shown SwiftUI 4.0 如何知道ShareLink是否分享成功 - SwiftUI 4.0 how to know if ShareLink has been shared successfully 如何知道在UITableView的标题部分进行了点击? - How to know what a tap has been made on a header section of a UITableView?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM