Attention:
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
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
Well, that's all the content of this article, and I hope it helps when you develop iOS.