The UIGestureRecognizer is easy to implement, and less error prone about touch event handling.
When second button is pressed, the press event may be entered on touchesBegan ,touchesMoved, or touchesEnded, you have to check [touches count] at these places. But if you want to handle dragging behavior, the touchesMoved is the best place to check two touches or only one touch.
As Eiko said, you should implement touchedCanceled.
The sequence of touch event may be
- touchedBegan -> touchedMoved -> touchedEnded -> touchedCanceled,
- or touchedBegan -> touchedMoved -> touchedCanceled (no touchedEnded).
If there are no movement, then touchedMoved won't be called. It means the sequence of touch event will be
- touchedBegan -> touchedEnded -> touchedCanceled.
- or touchedBegan -> touchedCanceled.