【发布时间】:2020-09-17 19:33:34
【问题描述】:
我遇到了 Xcode 12 / iOS 14 的问题。在带有 NavigationView 的工作表中使用多个 NavigationLink 会导致 NavigationLink 条目在返回页面后保持突出显示。这不仅是模拟器的问题。请参阅随附的 GIF:
有人知道如何解决这个问题吗?
类似问题:SwiftUI - NavigationLink cell in a Form stays highlighted after detail pop(但这不是这里的问题)。
struct ContentView: View {
var body: some View {
Text("")
.sheet(isPresented: .constant(true), content: {
NavigationView {
Form {
Section {
NavigationLink("Link to ViewB", destination: ViewB())
}
}
.navigationBarTitle("ViewA")
}
})
}
}
struct ViewB: View {
@State var selection = 0
let screenOptions = ["a", "b", "c"]
var body: some View{
Form {
Section {
NavigationLink("Link to ViewC", destination: ViewC())
}
}
.navigationBarTitle("ViewB")
}
}
struct ViewC: View {
var body: some View{
Form {
Section {
Text("Test")
}
}
.navigationBarTitle("ViewC")
}
}
【问题讨论】:
-
看起来像
sheet中的一个错误 - 没有它也可以正常工作。您可以向 Apple 提交错误报告。 -
终于没有遇到取模的bug (i % 2) == 0 not working :))))))))))))))))) 我笑了河流:)
-
天哪,是的,我提交了一个错误报告。希望这会很快得到解决。
-
我最终完全重新实现了表单。