如何解决分组列表角半径问题?

时间:2020-08-26 21:41:31

标签: ios swift swiftui

我使用分组列表样式列出事件。我有一个有趣的问题。我添加了NavigationLink以转到事件详细信息,但是当我单击事件页面上的后退按钮时,事件列表项的角半径为零。如果您看下面的屏幕截图,您会明白我的意思:)

在进入详细信息页面之前:

enter image description here

之后:

enter image description here

我的代码:

List {
    ForEach(self.viewModel.data, id: \.id) { event in
        Section(header:
            HStack {
                Text("\(event.date.dateValue().eventTime())")
            }
        ) {
            NavigationLink(destination: EventDetail(data: .constant(event))) {
                HStack {
                    Text(event.title)
                }
                Spacer()
                ZStack {
                    Image(systemName: "circle.fill")
                    Text("\(event.invited.count)")
                }
            }
        }
    }
}.listStyle(GroupedListStyle()).environment(\.horizontalSizeClass, .regular)

1 个答案:

答案 0 :(得分:0)

我无法解决此问题,我认为这是苹果的错误。我没有分组列表就做出了类似的视图:)如果有人感兴趣,我将这些样式添加到了NavigationLink内部的HStack中

.padding().background(Color(UIColor.systemGray6)).cornerRadius(12)