iOS, Android development Getting started event handling several ways

Source: Internet
Author: User

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

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.