1

When the user has 2 fingers on a UIView and lifts both simultaneously this code will determine event.touches(for: self).count to be 2.

override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {

        print(event?.touches(for: self)?.count)

}

I presume this is because those 2 events are merged into one "fingerlifting" instead of two.

But then how do I determine if there are any fingers left on the UIView?

Usually, when the last finger is lifted I am able to query event.touches(for: self).count and it will (if it was indeed the last finger that was touching the UIView) return 1. But this does not work in this exeption.

Marmelador
  • 790
  • 5
  • 22

0 Answers0