2 개의 UIView가 있습니다. 개별적으로 잘 작동합니다. 그러나 UIView 2 하위 UIView overlapped, 위쪽 UIView 1 덮여있는 영역에 등록하지 않습니다?오버랩 UIViews가있는 스위프트 제스처 인식기
UIView의 1 (마젠타)의 UIView 겹치는 2 (석회)
UIView의 1 (마젠타)의 좌/우 와이프를 수용한다.
UIView 2 (석회)는 위/아래 슬쩍을 허용합니다. 중복 UIView의 1 (마젠타)없이 표시
@IBOutlet weak var swipeAB: UIView!
@IBOutlet weak var swipeBC: UIView!
func calculateAB(sender:UISwipeGestureRecognizer) {
print("Swiped right, A to B")
}
func calculateBA(sender:UISwipeGestureRecognizer) {
print("Swipe left, B to A")
}
func calculateBC(sender:UISwipeGestureRecognizer) {
print("Swiped down, B to C")
}
func calculateCB(sender:UISwipeGestureRecognizer) {
print("Swipe up, C to B")
}
override func viewDidLoad() {
super.viewDidLoad()
moveAB.addTarget(self, action: #selector(GameViewController.calculateAB))
moveAB.direction = .Right
swipeAB.addGestureRecognizer(moveAB)
moveBA.addTarget(self, action: #selector(GameViewController.calculateBA))
moveBA.direction = .Left
swipeAB.addGestureRecognizer(moveBA)
moveBC.addTarget(self, action: #selector(GameViewController.calculateBC))
moveBC.direction = .Down
swipeBC.addGestureRecognizer(moveBC)
moveCB.addTarget(self, action: #selector(GameViewController.calculateCB))
moveCB.direction = .Up
swipeBC.addGestureRecognizer(moveCB)
}
슬쩍 감지? 그런 다음 오른쪽 상단 UIView 2 제스처를 것입니다, 나머지 1을 것이라고? 당신이하려고하는 것에 따라 이것을 할 수 있는지 확실하지 않습니다. – impression7vx
이것은 트릭을 만들었습니다. 나는 답을 보여주는 사진을 올렸습니다. –