Jump between controllers

Source: Internet
Author: User

1. Code jump, VC interface needs to be written on Xib

Uiviewcontroller *VC = [[Uiviewcontroller alloc] init];//General Controller

[Self PRESENTVIEWCONTROLLER:VC animated:yes completion:nil];

2.storyboard button Jump, no connection, can also pass value
-(Ibaction) ItemClick: (ID) Sender {
Uiviewcontroller *three = [[Uistoryboard storyboardwithname:@ "Main" Bundle:nil] instantiateviewcontrollerwithidentifier:@ "three"];
[Self presentviewcontroller:three animated:yes completion:nil];
}

3.storyboard Drag the first Controller button directly to the second controller to select Show. Click to jump

4.storyboard two controllers connected, with a segue setting identifier, jump through code:
[Self performseguewithidentifier:@ "segue" sender:self];
And you can pass the value by Prepareforsegue: method.
-(void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: (ID) Sender {
Segue.identifier: Get the ID of the connection
if ([Segue.identifier isequaltostring:@ "Sendvalue"]) {
Segue.destinationviewcontroller: Gets the interface (VC) referred to in the connection
Receiveviewcontroller *receive = Segue.destinationviewcontroller;
Receive.name = @ "Garvey";
Receive.age = 110;
There is no need to specify a jump, as there is already a jump code in the button-down event
[Self.navigationcontroller pushviewcontroller:receive Animated:yes];
}
}

Jump between controllers

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.