StoryBoard Page Pass Value

Source: Internet
Author: User

Create a new Viewcontroller and Detailviewcontroller

The idetnifier of the VC and DETAILVC lines is set to:GODETAILVC

  viewcontroller main code
-(Ibaction) signinbuttontouched: (IDsender {[Self performseguewithidentifier:@"GODETAILVC"sender:self];}#pragmaMark-prepare Segue//A page is passed to page B- (void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: (IDSender {[Super Prepareforsegue:segue Sender:sender]; if([Segue.identifier isequaltostring:@"GODETAILVC"]) {Detailviewcontroller*DETAILVC =Segue.destinationviewcontroller; Detailvc.passvalue=Self.usernameTextField.text; }}//b page Pass value to page a-(Ibaction) Done: (Uistoryboardsegue *) segue{if([Segue.sourceviewcontroller Iskindofclass:[detailviewcontrollerclass]]) {Detailviewcontroller* svc = (Detailviewcontroller *) Segue.sourceviewcontroller; Self.passwordTextField.text=Svc.textField.text; }}

Done method Detailviewcontroller in storyboard with the Done button action associated to Viewcontroller

1. In the VC page, enter a value in the first TextField click the Sing in button will send the value to Detailviewcontroller TextField display.

2. Change values in Detailviewcontroller TextField Click the Done button to upload the value back to Viewcontroller

If it is the present way to pass the value of Le.

Use the following code to confirm that the value is not feasible
-(void) Prepareforsegue: (Uistoryboardsegue *) Segue sender: (ID) sender { [super Prepareforsegue:segue Sender:sender]; if ([Segue.identifier isequaltostring:@ "godetailvc"]) { *DETAILVC = Segue.destinationviewcontroller; Because this is navigationcontroller, not Detailviewcontroller.
=

}

So the changes are as follows:
// a page value to page B -(void) Prepareforsegue: (Uistoryboardsegue *) Segue sender: (ID) sender{    [Super Prepareforsegue:segue Sender:sender];     if ([[[Segue Identifier] isequaltostring:@ "godetailvc"])    {        *viewcontrollerarray = [Segue.destinationviewcontroller viewcontrollers];         *DETAILVC = [Viewcontrollerarray objectatindex:0];         = self.usernameTextField.text;    }}

StoryBoard Page Pass Value

Related Article

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.