0

Я ищу конечную позицию touchesEnded. Мой touchesBegan код выглядит следующим образом:Почему местоположение не отображается в штрихах?

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { 
    if let touch = touches.first { 
     touchStart = touch.locationInNode(self) 
     print("touchStart_1: \(touchStart)") 
    } 
} 

Отпечаток дает мне место.

В touchesEnded я следующее:

override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { 
    if let touch = touches.first, start = touchStart { 
    print("touchStart_2: \(touchStart)") 
    let location = touch.locationInNode(self) 
    print("touchEnded: \(location)") 
    } 
} 

Ни один из этих гравюр возвращает ничего. В качестве дополнительной информации я использую UISwipeGestureRecognizer, а также в другом месте, но я понимаю, что распознаватели жестов работают независимо от касаний. Любая идея, что случилось?

ответ

0

Установить этот жест 2 свойства:

let swipeGesturte: UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: "swipeAction:") 
swipeGesturte.direction = UISwipeGestureRecognizerDirection.Right 
swipeGesturte.cancelsTouchesInView = false // 1. 
swipeGesturte.delaysTouchesEnded = false // 2. 
self.view.addGestureRecognizer(swipeGesturte) 

Для Подробнее о cancelsTouchesInView: What really happens when call setCancelsTouchesInView?

+0

Это фантастическая. благодаря –

 Смежные вопросы

  • Нет связанных вопросов^_^