About the event transfer mechanism ., Event transfer mechanism.
Each ViewGroup includes onInterceptTouchEvent () and TouchEvent ()
Each View contains: TouchEvent ()
The event starts from the ViewGroup and passes to the ViewGroup or View.
The event cannot be passed down all the time, so onInterceptTouchEvent () is used to prevent the event from being passed like the following control.
Use TouchEvent () to prevent the event from being passed up TouchEvent. (If the return value is used, true indicates that the request has been consumed, and false indicates that the request is continuously transmitted)
For example, when the returned values are both false:
:
When the value of onInterceptTouchEvent () in LayoutView2 is true:
When both LayoutView2 Methods return true values:
Problem: We thought that only when false is returned can we avoid consuming events, so that the events can be passed between Down, Move, and Up. But this is not the case.
Each of the Down, Move, and Up events is an independent event entity. If the Down event cannot be consumed, the subsequent Move and Up events cannot be executed.
How does one understand the messaging and event-driven mechanisms of windows applications?
Windows applications are all message-driven (the so-called event. Any window can receive messages and make corresponding actions for each message.
Objective-c event Transfer Mechanism
Nsicationicationcenter can transmit messages