Pocketed X input method is how to deal with the problem of delayed edge of the screen

Problem

Pocketed in the development process input,I have always been plagued by a problem,That is when the user clicks on the left edge of the screen, UIButton of touchDown event almost turned into a touchUpInside 。That is,Both occur simultaneously,And when you press only when, touchDown no longer be called until the moment you lift your finger,Only trigger touchDown 。 It is quite clear on the keyboard,Touch-tone、Key visual cues and vibrating alert are therefore postponed,When continuous input,In the event of the left edge of the screen Q Key,It is obvious to feel what type flow Caton。 In fact, this problem is due to the 3D Touch multitasking and swipe gesture to switch back from the edge of the screen to the right leads to the。Because the two are global system iOS,So it is difficult to bypass the upstream bug。
Even in the iPhone X Series in full screen,Keyboard This problem has not improved,Have become the situation on both sides of the screen are delayed。

App in solution

This error is a long time,But until iOS 11,With barely be considered a solution: preferredScreenEdgesDeferringSystemGestures: UIRectEdgeYou need to override this variable in your ViewController,Let your app a higher priority than a gesture to the system。

In keyboard configuration program

Measures proposed above,In the extended keyboard is not in force - becauseAnd do not have permission。to this end,I made a subclass of UIButton,And where func point(inside point: CGPoint, with event: UIEvent?) -> Bool This method is used to determine the user clicks,Its advantage is that no matter where the user clicks,The first time will be triggered。 When it is determined that the current Button when clicked,We call manually trigger touchDown。 So no matter where the user clicks,The keyboard can respond correctly the first time - but,New problems have cropped up,Since the click itself will produce touchDown ,All normal clicks turned into two (or more shares,TouchDown has made continuous event turned into a touchDownRepeat),You need to do extra clicks filter,Since the transfer click on the effect of the realization of a wide variety,Here is not to do in-depth launched。

Published by R0uter

The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Join the Conversation

2 Comments

Your email address will not be published. Required fields are marked *

    1. Unfortunately this part of the code I've gone,Because I finally changed another way to achieve the effect ...... Click on this program because my key processing flow for ...... some conflict areas。