Taps not detected near edges of screen on iOS device (OpenFL 3.6.1)

This is a game I made with HaxeFlixel (latest version 4.3.0), and so uses OpenFL 3.6.1.

At first I thought this was a hardware issue, but then I noticed that only my most recent game wasn’t detecting touches near the top and bottom of the screen reliably (in landscape position). Other apps (including older games I made with HaxeFlixel) work fine. I have also tested this with a minimal project template, and the issue is still there.

I have been testing on an iPhone 5s. This problem does not occur in the simulator, nor on Android devices.

Detailed characteristics of the problem:

  • The beginning of a touch is not detected near the longer edges of the screen, unless I hold it for about 1 second.
  • The end of a touch is detected reliably.
  • For some reason, if I’m holding a tap anywhere on the screen, I can then tap with another finger on the edges and the start of those taps are detected reliably.

I have traced the problem to Lib.current.stage.addEventListener(TouchEvent.TOUCH_BEGIN, handleTouchBegin); This event isn’t triggered when I start a tap near the edges.

Any ideas of what could be causing this? Thanks in advance.

This is something I’ve started noticing as well (and I’m not using HaxeFlixel). I wasn’t sure if it was due to a change in OpenFL or if I had just never noticed the issue before.

Interesting. I wonder if it’s related to an upgrade in Xcode and/or iOS version.

I believe this is an OS behavior, relating to gestures?

I thought I saw that something in the newer SDL update had an improvement that would help us in this regard, but I forget where it is now. I see gesture code, but for tvOS, not for iOS

How would one go about fixing this?

Old iOS “problem/feature” :wink:
I added an exception for iOS: I simply move the buttons far enough from the screen side.

Yeah but in my game you can tap anywhere on the screen and there’s a local multiplayer feature where players tap on the corners of the screen. If I have to restrict taps so they can’t be made near the edges, it’s awkward to play.

And for some reason this doesn’t happen in my older games, even when played in iOS 11.

Maybe older Openfl/Lime didn’t support some iOS function: well, I introduced the exception about 2…3 years ago.
What’s your target? Mine is HTML5.

Could be. The target is ios.

Ah ok, I thought you could be in a browser on iOS.
Well, it is interesting to know that the problem exists on native applications too, and not on browser-dependent JSs only.

1 Like

It seems from what I read here that the solution to the problem is to override the following view controller function in this manner:

override func preferredScreenEdgesDeferringSystemGestures() -> UIRectEdge {
  return fullScreenMode ? [.bottom,.top] : UIRectEdge()

Is there a way to add this code when exporting for ios? If it were android, I would make an alternate GameActivity.java and point to it with <template …/> from project.xml, but there seems to be no such relevant file for ios in the template.

I was able to solve the problem by adding:

    return UIRectEdgeAll;

to UIStageViewController in lime\legacy\project\src\iPhone\UIStageView.mm and recompiling Lime :smile:

I think this should be resolved in the SDL we are including in our next release:


Hi, sorry to bring this up now.
I am facing the same exact problem described in first topic.
I am on lime 7.7.0 and everything is up to date.
Anyone is in the same situation?

Is <window fullscreen=“true” />?

yes, of course.
I resolved with this >>> Overriding in UIViewController for iOS extension <<<