How the iOS interface passes values (a) block pass value

Source: Internet
Author: User

the first part uses the block to pass the value the thought and the step

To use the block value, you have to first figure out what time

Who is the target object of the one-pass value?

Need to get the worthy object

Who is the second-most-valued person?

The object that needs to pass the value to the target object

Communication between the three-valued person and the target object

Using block communication

The general idea is as follows:

1 Define a block of code in the header file of the person who passed the value, and make him a property of the person who passed the value

2 Implement the block code in the implementation method of the value-passing

3 Import the header file of the caller in the target object header file for the value of the pass

4 in the target object where the value is passed, call the code block

The second part of the project demonstration

In this project, Viewcontroller as the target object, Secondcontroller as the value of the transfer.

The code for Viewcontroller is as follows:

the code for Secondcontroller is as follows:

Part III


How the iOS interface passes values (a) block pass value

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.