swift - 嵌套按钮没有响应
问题描述
我在 hstack 中并排有一个导航链接和一个按钮,但点击时两者都没有响应。
navigationbaritems 按钮按预期工作。
NavigationView {
ZStack {
"Buttons here works fine"
VStack{
HStack(alignment: .center) {
NavigationLink(destination: ProfileView()) {
Text("anonymous")
.font(.caption)
.fontWeight(.bold)
}
Spacer()
Button(action: { self.cardOptions.toggle() }) {
Image(systemName: "ellipsis")
.frame(width: 32, height: 32, alignment: .center)
.font(Font.title.weight(.black))
.foregroundColor(Color("costumLightGrey"))
}.alert(isPresented:$cardOptions) {
Alert(title: Text("Alert"), message: Text("Message"), primaryButton: .destructive(Text("Delete")) {
print("Did tap")
}, secondaryButton: .cancel())
}
}
}
}
}
解决方案
推荐阅读
- android - Firebase 云消息到 ios 和 android 设备
- python - PySpark DataFrame SQL - 某些条目中具有特殊字符的列的最大值
- java - 在 JavaFX 场景和非 JavaFX 场景之间切换
- javascript - 通过javascript填充html表格
- java - 每当我在 JTextField 中写入时,Swing java JComboBox 就会消失
- sql - 为什么我的查询试图转换我的源查询未返回的问题字段?
- java - 我如何摆脱java中的几个小数点?
- r - 有没有办法使用 R 中的 beta 分布参数找到中位数?
- python - 从变量函数输入中制作 Tkinter 标签句柄?
- c++ - 使用 Arduino 编程 ATtiny10(“ld.exe”错误)