A summary of the jump method between Apple iOS interface

Source: Internet
Author: User


The following Firstviewcontroller (FVC) button buttons Click to jump to Secondviewcontroller (SVC) as an example to illustrate:

Mode one: The segues way of storyboard

Mouse click button and then hold control key drag to the SVC page, in the pop-up Segue page Select the Jump mode can be

Invfnn

Advantages: Easy to operate, no code generation, storyboard in the display of logic clear
Disadvantages: The page is not convenient to view more when the team cooperation can be poor maintenance, many people do not recommend this mode of cooperation.

Mode two: Tab Uitabbarcontroller Controller

By calling the Uitabbarcontroller Addchildviewcontroller method to add a child controller, the code example is as follows:


Uitabbarcontroller *TABBARVC = [[Uitabbarcontroller alloc] init];
Firstviewcontroller *FVC = [[Firstviewcontroller] init];
FVC.tabBarItem.title = @ "Controller 1";
FVC.tabBarItem.image = [UIImage imagenamed: @ "First.png"];
Secondviewcontroller *svc = [[Secondviewcontroller] init];
SVC.tabBarItem.title = @ "Controller 2";
Svc. Tabbaritem.image = [UIImage imagenamed: @ "New.png"];
Add child controllers (these child controllers are automatically added to the Uitabbarcontroller viewcontrollers array)
[TABBARVC ADDCHILDVIEWCONTROLLER:FVC];
[TABBARVC Addchildviewcontroller:svc];

Advantages: Less Code

Disadvantage: Tabbar's iOS native style is not very good-looking, (not commonly used, currently not recommended), if you want to use, recommend custom Tabbar

Mode three: Navigation controller Uinavigationcontroller

Called in the listener method of the FVC button:

[Self.navigationcontroller PUSHVIEWCONTROLLER:NEWC Animated:yes]; Jump to Next page

Called in the method of the SVC:

[Self.navigationcontroller Popviewcontrolleranimated:yes]; Back to previous page

When there are multiple jumps occurring and you want to return to the root controller, call:


[Self. Navigationcontroller poptorootviewcontrolleranimated:yes]; Returns the root controller, which is the first page

Mode four: Display the controller with Modal form

Called in FVC:


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

Called in Svc:

[Self dismissviewcontrolleranimated:yes completion:nil];

Mode V: Directly change the UIWindow Rootviewcontroller

Summarize:

Storyboard method suitable for personal development of small programs, with team work or project is not recommended when a large
Uitabbarcontroller because the current system's native style is not very beautiful, do not recommend the use of
There are no obvious drawbacks to using uinavigationcontroller and modal, and most programs now use both, just to see if a navigation controller is needed to determine which scenario to use

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.