【问题标题】:SwiftUI - DragGesture and .onDelete conflictSwiftUI - DragGesture 和 .onDelete 冲突
【发布时间】:2021-03-12 21:26:18
【问题描述】:

我的手势有冲突:

import SwiftUI

struct ContentView : View {

@State var showSearchBar = true

var body : some View {
            NavigationView {
                 Form {
                      ForEach(//code) { values in
                      NavigationLink(//code)
                      }
                      .onDelete(perform: //delete action)
                      }
                    .simultaneousGesture(
                        DragGesture()
                            .onChanged({ gesture in
                                if gesture.location.y > gesture.startLocation.y {
                                    showSearchBar = false
                                } else {
                                    showSearchBar = true
                                }
                            })
                    )}}}

但是,这两种手势都不起作用。如果我删除 .simultaneousGesture,则 .onDelete 有效,但如果我同时保留两者,则只有 .simultaneousGesture 有效。我怎样才能使两者都工作?

感谢所有帮助我的人!

【问题讨论】:

    标签: swift gesture drag gesture-recognition


    【解决方案1】:

    建议您向 Apple 开发人员支持提出此问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-18
      • 1970-01-01
      • 2020-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多