【问题标题】:SwiftUI Navigation title overlappingSwiftUI 导航标题重叠
【发布时间】:2021-03-31 11:45:11
【问题描述】:

在 SwiftUI 导航屏幕之间导航后,标题重叠。这是我的代码。

NavigationView {
    List {
        ForEach(productCategories) { index in
            NavigationLink(destination: AllProductsList(categoryID: index.categoryID, categoryTitle: index.name)) {
                ZStack(alignment: .bottomLeading) {
                    VStack {
                        WebImage(url: URL(string: serviceLink + "/image/" + index.image))
                            .resizable()
                            .indicator(.activity)
                            .aspectRatio(contentMode: .fill)
                            .frame(width: screen.width - 30, height: 300, alignment: .center)
                            .clipShape(RoundedRectangle(cornerRadius: 30, style: .continuous))
                    }
                    Text(index.name)
                        .font(.system(size: 40, weight: .bold, design: .rounded))
                        .foregroundColor(.white)
                        .padding()

                }
            }
        }
    }
    .navigationTitle(Text("Kategoriler"))
    .navigationBarTitleDisplayMode(.large)

【问题讨论】:

  • 上面的代码对我来说很好用。也许也可以从目标视图中显示您的代码?

标签: swift swiftui navigation


【解决方案1】:

我解决问题

.isDetaillink(false)

我需要将它添加到导航链接的末尾

【讨论】:

  • 仅当您在列表行中有 NavigationLinks 时才有效。就我而言,我没有,我有类似于提醒应用程序的详细图标,所以找不到替代修复。该问题仅在设计模式下出现,如果您进入“实时预览”模式,重叠就会消失。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-09-27
  • 2017-11-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-02-05
  • 2021-11-29
相关资源
最近更新 更多