IOS Learning Notes forward reverse exercise--Lan Yi Education

Source: Internet
Author: User

Forward-passing value Lan Yi education

Jump from Viewcontroller (Class A) to Secondviewcontroller (Class B) during a jump page

A Secondviewcontroller page created in Viewcontrolller

So, from the Viewcontroller to the second, the forward value is transmitted.

If it's text, then it's actually a string, so we're going to start with SecondViewController.h.

Build an attribute nsstring*accept. h is open and visible

So Viewcontrolller.

[Email protected] "111";

Secondviewcontroller *s2=[[secondviewcontroller Alloc]init];

S2.ns=self.l111.text;

[Self presentviewcontroller:s2 animated:yes completion:nil];

So in the second page can output [email protected] "111";

Reverse pass-through value

The first step

First, in Class B. h, add #import "Class A Viewcontroller"

Then create a Class A Viewcontroller property

@property (nonatomic,weak) Viewcontroller *l1;

Step Two

Creating a position setting for Class B Objects (B1) in Class A

b1.delegate=self;

Step Three

The method and method types used to establish a reverse value (call) in Class A are different depending on the purpose

-(void) fanxiangaction;

Fourth Step

In class B, the reverse value (the location of the call) is required to enable

[Self.delegat fanxiangaction];

Fifth Step

Receives the value of the called B in a method called by Class B in Class A, or implements the required method

-(void) {

}

IOS Learning Notes forward reverse exercise--Lan Yi Education

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.