我有一个很大的披露组,它比整个屏幕还大。它基本上是大量的文本。
我怎样才能添加一个固定的标题在顶部将我向下滚动?
我需要这个,因为我想让用户知道什么披露组目前的阅读。
节已经这样做了,但我想使用公开组,因为它们更容易绑定,以及展开/折叠。
有一节教程,但我想为披露组:https://swiftontap.com/pinnedscrollableviews/sectionheaders
这可能是揭露集团吗?
DisclosureGroup("First description") {
Text("big amount of text")
}
1条答案
按热度按时间e0bqpujr1#
使用DisclosureGroup似乎很困难,但您可以使用下面的自定义视图非常简单地复制类似类型的行为。这有点初级,但希望能为您提供一些想法和功能。您可以复制DisclosureGroup的外观和感觉,并在CustomDisclosure HStack中扩展chevron。需要注意的主要问题是,ZStack会尝试占用所有提供的空间,因此有时候如果有可用空间,折叠的行似乎会保持其展开后的大小。
我已经更新了自定义的DiscloseView,所以它现在把扩展的视图作为一个闭包,与DisclosureGroup、VStack等相同,所以你可以根据自己的喜好自定义扩展的视图。