iosswifttouchesbegantouchesendedtouchescancelled

Detect palm touching/releasing the iphone screen


Implementing a sort of 'distress call' button which should work as following:

  1. User starts application and covers a screen with a palm of a hand
  2. Some time passes, user may introduce additional touches during that time or remove some of the existing (but not all of them), location/shape of touches may change
  3. When user releases a hand (i.e. removes last touch) a distress signal is emitted by the app

Basically, the app should register two events: (1) a screen is touched (2) all touched are released

I'm trying to use touchesBegan/touchesEnded methods and those work for small area touches (fingertips) but on touching screen with a full palm or even only palm edge a touchesCancelled gets triggered immediately while hand is still on the screen. Obviously no other events are emitted upon hand release afterwards.

I tried subclassing UIWindow and UIApplication and overriding sendEvent in those but got no additional info - large area touches are triggering touch begin and immediately touch cancel, releasing hand afterwards emits nothing. In some cases large area touches fire no events at all, not even the touchesBegan. Basically, iOS doesn't let me work with a very basic scenario - detecting just the fact of screen touch/release.

Is there any way to query the screen touch state directly and not work with responder chain? Or suppress the cancellation event from firing? Or maybe I'm missing something?


Solution

  • Unfortunately, as of right now, no solution exists