嵌套按钮无响应

时间:2019-10-17 23:48:49

标签: swift swiftui

我在hstack中并排有一个Navigationlink和一个按钮,但是点击时它们都没有响应。

导航栏按钮按预期工作。

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())
                }
           }
       }
    }
}

0 个答案:

没有答案