【发布时间】:2022-08-15 03:33:52
【问题描述】:
???一旦触发 \"Logout\" 文本或 \"logout\" 图标,我就有以下代码段导航到另一个页面:
//$tempSignout is a boolean var -> @State var tempSignout = false
NavigationLink(destination: SigninView(), isActive: $tempSignout) {EmptyView()}
Button(action: {
tempSignout = true
}, label: {
HStack{
Text(\"Logout\")
.underline()
.foregroundColor(Color(\"logoutColor\"))
.frame(width: 100, height: 50)
.padding(.trailing, -100)
Image(\"logout\").resizable()
.frame(width: 30, height: 30)
.padding(.leading, 100)
}
})
???这是代表上述代码段的 UI:
???问题是:无论我按注销文本还是图标,我都无法导航到目标页面,它似乎根本无法点击。
-
最好向我们展示一个最小的可重现代码,以显示您的问题。看看这个:stackoverflow.com/help/minimal-reproducible-example
标签: swift swiftui swiftui-navigationlink