【发布时间】: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