[iOS advanced] UIButton workaround for unresponsive or delayed response to Uicontroleventtouchdown events

Source: Internet
Author: User

Uicontroleventtouchdown the method that should be triggered when the button is pressed. The actual use of the process will be delayed response or intermittent unresponsive, but release the finger will respond directly to Uicontroleventtouchdown, UIControlEventTouchUpInside two methods, in which case, press the button does not respond to any events, When you move your finger, it responds to Uicontroleventtouchdown.

1. Delayed response:

This is usually because the button is placed above the Uiscrollview or UITableView, and the system will determine if the swipe gesture is being pressed. will be UIScrollVIew的delaysContentTouches canCancelContentTouches两个属性都设置为NO;

2.无响应:查到的资料,有人说“

    UIControlEventTouchDown事件是一旦手指碰到按钮就调用了,这样在iOS7上会产生一个冲突,由于iOS7加上了手势滑动返回这么一个动作,
    在手势滑动返回时那个区域是不允许有UIControlEventTouchDown事件的,不然就会有事件冲突了,系统不知道是要准备返回还是要点击那个Button,
    所以就加上了TouchDown事件的一个延迟响应。
    解决方案
  

    •     禁止所有滑动返回的手势,让TouchDown能够正常响应 self.navigationController.interactivePopGestureRecognizer.delaysTouchesBegan=NO;
    •     重写UIButton,捕捉所有的手势事件然后重写”。

I have no effect on this test, maybe my posture is wrong? My button is in the bottom right corner of the ipad when it's flat screen, and then I find it's OK to move the button up a bit (I moved up 20 pixels). Both of these cases are passed by the ipad Air test and are for informational purposes only.


[iOS advanced] UIButton workaround for unresponsive or delayed response to Uicontroleventtouchdown events

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.