没有披露指示器的SwiftUI NavigationButton? [英] SwiftUI NavigationButton without the disclosure indicator?

查看:34
本文介绍了没有披露指示器的SwiftUI NavigationButton?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用推送到新视图的行制作列表时,SwiftUI 会自动添加一个显示指示器>"?如果我不想要它,如何删除它?

When making a List with a row that pushes to a new view, SwiftUI adds a disclosure indicator ">" automatically? How do I remove it if I don't want it?

    NavigationView {
        List {
            NavigationButton(destination: DetailView()) {
                ListItem()
            }
        }
        .navigationBarTitle(Text("Some title"))
    }

在 UITableViewCell 上,您将 Accessory 设置为 None 但我如何在 SwiftUI 中做到这一点?

On a UITableViewCell you set Accessory to None but how do I do that in SwiftUI?

推荐答案

设置 NavigationLink 宽度并隐藏它对我有用

Setting the NavigationLink width and hiding it did the trick for me

List {
  ForEach(pages) { page in
    HStack {
      Text("Something")

      NavigationLink(destination: Text("Somewhere")) {
        EmptyView()
      }
      .frame(width: 0)
      .opacity(0)
    }
  }
}

这篇关于没有披露指示器的SwiftUI NavigationButton?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆