As an iOS app developer, the usual event handling mechanisms for iOS apps must be mastered. Now let's talk about the iOS event handling mechanism in several ways.
1. Implement event handling through Ibaction bindings
Ibaction is a special method in the controller component that can be used as an event-handling method for UI controls in interface design files.
2. Set event handling methods through code
Most controls that can interact with users in iOS apps inherit the Uicontrol base class, which provides many ways to register and delete event-handling methods.
3. Handling events through Delegate objects
For some particular UI controls, there are special events of their own that cannot bind the event handlers directly in the interface design file to the specified Ibaction method or bind the event-handling method, and the delegate object must be used to handle the special event.
In summary: Most components are capable of event handling through the first to second method. However, some controls can only use the third method for event handling because they do not inherit the Uicontrol base class. For example: Uitable controls, Uitextview controls, Uipickerview controls, and so on.
Based on an iOS-developed event-handling approach, there are several ways that Android event processing can be handled in two ways:
1. Listener-based event handling: Define the component first, then set the listener for the component.
2. Callback-based event handling: Let each component inherit the UI class and override the event-handling method for that class. When the component encounters an event, the corresponding event-handling method is triggered.
For more details on iOS and Android event handling methods, please refer to the relevant information.
This article is from the "faint on the Good," blog, please be sure to keep this source http://stchallenge.blog.51cto.com/10787849/1702753
iOS, Android development Getting started event handling several ways