Jump between multiple storyboards in iOS

Source: Internet
Author: User

Stroyboard can be seen as a collection of management View images. That is to say, there is no limit on one Storyboard in an iOS project.
Therefore, in your APP project, you can place similar views in the same APP to form a group to facilitate functional management.

1. Prepare two storyboards in the project

Create two storyboards in an IOS project.


2. In the first StoryBoard, we pulled a Navigation Template and pulled a Button in the [Main View Controller] View.

3. In the second StoryBoard, we also pulled a Navigation template.
In the screen, pull a Label and change the text to Storyboard2. This is only used to identify the image we are currently taking.

4. In the Botton in the first StoryBoard screen, we need to write the program code below in the [TouchUpinside] event of the button.

UIStoryboard * secondStoryBoard = [UIStoryboard storyboardWithName: @ "Storyboard2" bundle: nil];
UIViewController * test2obj = [secondStoryBoard instantiateViewControllerWithIdentifier: @ "test2"]; // test2 is the StoryboardId of viewcontroller
[Self. navigationController pushViewController: test2obj animated: YES];
The first step is to specify the UIStoryboard object. Here we will point to the second Storyboard in the project.

Next, we need to create a New Controller object. This is the next View page to which you want to Push the object.
Finally, use self. navigationController to push the webpage to the next page.

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.