Uiscrollview Event Interception

Source: Internet
Author: User

In the daily development, we often use uiscrollview, however, it is a problem-frequency control, For example, if you use it in nib, you must create a contentview for it manually. Of course, the use of the spring code when using lazy loading mechanism so that it can have a contentview, today we do not talk about this problem, Let's talk about Uiscrollview's event interception related knowledge.

Before you get to the point, fill in the knowledge points: The response chain "responder Chain".ios device has a lot of elements on the screen when the user triggers an event:

User-triggered events--system framework Uikit Create an event object that contains various information about the event, add it to the event queue in the foreground app, and uiapplication the event to the current Window object ( Generate different new objects based on different event objects)

① Touch event, pass new object---Trigger Event view (hit-testing).

② shake or Remote control event the->window object passes a shake event or remote control event to the first responder to handle.

Now let's talk about a phenomenon:

1> Add a Contentview on the Uiscrollview, add a few buttons on the Contentview, run

You will find that there is a delay when the button is clicked,

2> set Delaycontentstouches to No

You will find that you cannot slide scrollview on the button

3> customizes a class, inherits Uiscrollview, Overrides Method-(BOOL) Touchesshouldcancelincontentview: (UIView *) view, and returns Yes directly:
You will find that the problem is solved.

Uiscrollview Event Interception

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.