简体   繁体   English

SwiftUI - NavigationView 向列表视图添加详细信息指示器 ">" - 如何删除?

[英]SwiftUI - NavigationView Adds Detail Indicator ">" to List View - How to remove?

When using a NavigationView to link to a Detail View from a List, SwiftUI automatically adds a > detail/disclosure indicator to the right side of the List view row.当使用 NavigationView 从列表链接到详细信息视图时,SwiftUI 会自动在列表视图行的右侧添加一个>详细信息/披露指示符。 The > and the padding around it are causing issues with my layout which I would like to extend all the way to the end of the row. >及其周围的填充导致我的布局出现问题,我想一直将其扩展到行尾。 How can I remove the disclosure indicator?如何删除披露指示符?

The same question was asked here SwiftUI NavigationButton without the disclosure indicator?同样的问题在这里被问到 SwiftUI NavigationButton 没有披露指示器? but at the time, there was no solution, only work arounds that don't work so well.但当时,没有解决方案,只有行不通的变通办法。

Is there a solution to this problem yet, or is it a matter of waiting for SwiftUI to be updated?这个问题有没有解决方案,还是等待SwiftUI更新的问题?

Screenshot of the Issue:问题截图:

iOS13 , iOS 14 iOS13,iOS 14

List { 
    ForEach(items) { item in
        ZStack {
            CustomView(item: item)
            NavigationLink(destination: anotherView()) {
                EmptyView()
            }
              .opacity(0)
              .buttonStyle(PlainButtonStyle())
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM