5. How is iOS event handled?

Source: Internet
Author: User

iOS common event handling mechanism, there are three ways:

1. Bind a specific event of a control to the specified mode of the controller by Ibaction binding, and when this event occurs on the control, the corresponding method to which the control will be triggered.

Example: Is the way to drag the line.

2. Bind event listeners to specific events in the UI control in the program.

example (1),   Register event: [btn addtarget:self action : @selector (onclickbtn:) forcontrolevents:uicontroleventtouchupinside

Example (2), deleting an event: [btn removetarget:self action:@selector(onclickbtn:) forcontrolevents:uicontroleventtouchupinside];

3. For some life cycle events of a UI control, you can delegate directly to the corresponding delegate object processing.

Description: For a specific UI control, such as: Uilable control, cannot be the above method,

At this point, the system provides an event delegation interface specifically for uilable.

The object that implements the delegate interface for the event will be responsible for handling the special events of the Uilable control.

Example: >>??

5. How is iOS event handled?

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.