Ios-block Two interface transfer values

Source: Internet
Author: User

Let's talk about the idea first:

First, create two view controllers, create a label and a button in the first view controller, where the label is to display the string passed by the second view controller.

The button is to push to the second interface.

The second interface creates only one TextField, which is for entering text, and when the text is entered and the first interface is returned (the second view is going to disappear), the

The text in the textfiled is passed to the first interface and is displayed on the label.

Let's look at the specific code implementation process:

1. Instantiate the label and Button as well as the TextField process here I will not elaborate, I first go to the corresponding interface to create these three control keys

2. We want to use the block to pass the value, in the second view controller's. h file defines the attribute that declares the block

3. Implementing a method in the second view controller

4. Get the second view controller in the first view and invoke the defined properties with the second view controller

All right! This completes the block pass value! Ha ha...

Ios-block Two interface transfer values

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.