Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

iOS and MacOS / Detect the initial touch at bottom of the screen in iOS?

Author
Message
Zappo
Valued Member
20
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 29th Sep 2022 19:12 Edited at: 29th Sep 2022 19:23
Hi. I'm tearing my hair out on iOS when trying to detect the first touch at the bottom of the screen (landscape mode) in AppGameKit Studio. I am using the GetRawFirstTouchEvent(1) and GetRawNextTouchEvent() commands as I need to detect multiple touches, and here are my findings:

Touch anywhere above the bottom 1cm of the screen = detected instantly
Touch with 1 finger at the bottom and release immediately = detected instantly
Touch with multiple fingers at the bottom = all detected instantly
Touch and slide finger left/right at the bottom = detected instantly
Touch with 1 finger at the bottom and hold = not detected until about a second afterwards

It is like it is seeing it as a long-touch and ignoring that initial screen touch. I think this is the OS waiting for a swipe up to show media controls (called the "Control Centre"?) etc. This problem does not occur on Android.

Some quick test code:


Is there any way to turn off the "swipe up from the bottom" OS detection for iOS in AppGameKit, or always detect that initial touch event even if the finger is held down at the bottom of the screen? I need to instantly detect that first touch right down to the bottom of the screen.
Thanks.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 30th Sep 2022 17:39 Edited at: 30th Sep 2022 18:11
how does this fare for you?

that said, given the supporting commands, you can declare what constitutes a touch, hold, drag, slide, double-tap or any other gesture you can come up with based on "whatever" touch properties you like (without relying on AGK/OS determination of touch type).

this is, of course, assuming that there is no further conflict in manually retrieving Time/X/Y properties to make those determinations. if there is, i'd declare it a bug on the repo.

note: i don't have an iOS device to test on, so...
Zappo
Valued Member
20
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 1st Oct 2022 14:28 Edited at: 1st Oct 2022 15:24
Hi Virtual Nomad. Thanks for the suggestion but it still has the same issue.

This actually affect both the top and bottom of the screen. After some research it appears it may be something to do with Apple placing a GestureRecognizer or UIScreenEdgePanGestureRecognizer for the top and bottom of the screen to grab touches for when people slide their finger down to show the "Notifications" screen, or up to show the "Control Centre". This OS "feature" is overriding whatever touches the app is trying to detect. I'm not 100% sure as iOS is not my primary target environment but it makes sense.

I will do some more digging before I post on GitHub as it might be something simple like a setting in the Info.plist file or something. If I can offer a solution it would make fixing it much easier for TGC.

EDIT: I have now added this to GitHub as I think I might know what the problem is. In old versions of iOS (before 11) hiding the status bar told the operating system that your app wanted to override system gestures. This is no longer the case and you have to explicitly tell the system which edges of the screen you want take over handling the gestures for. One suggestion I found to fix this (and I have no idea if this applicable to AppGameKit Studio) would be to override preferredScreenEdgesDeferringSystemGestures. When a change is made to that you need to call setNeedsUpdateOfScreenEdgesDeferringSystemGestures for it to take effect. I hope that helps or at least points TGC in the right direction.

Login to post a reply

Server time is: 2024-11-21 11:21:14
Your offset time is: 2024-11-21 11:21:14