Jump from the Controller on one item of tabBarController to the Controller on another item, and redirect mvc to another controller.

Source: Internet
Author: User

Jump from the Controller on one item of tabBarController to the Controller on another item, and redirect mvc to another controller.

First, from the habitual tabBarController, many application boxes start with this, and from the Controller on one item of tabBarController to the other, usually, you can directly switch by clicking different items on the tabBar,

I 'd like to borrow someone else's figure... but how can I jump from a controller in item3 to the root controller in item1?

The process is as follows:

The jump of this process is actually related to the business process required by application development. If you jump from item3 to the Controller on item1, next time you click item3, if you need to display the root controller of item3, you can jump to it.

Note: To implement these redirects, you 'd better create a class to save the instantiated tabBarController, which is convenient to call in the entire program.

For example:

First, return to the root controller of item3 and do not display the animation.

[Self. navigationController popToRootViewControllerAnimated: NO];

Get it through your Method

UITabBarController * tabCtl

Then, you can forcibly switch the selected item of tabBarController to item1.

tabCtl.selectedIndex = 0;

 

If item3 does not need to return to the root controller, you only need to call

TabCtl. selectedIndex, but make sure that you have obtained UITabBarController.

If you want to jump to the second controller of item1, you can do this. If the controller is not instantiated, it also needs to be instantiated. Otherwise, the controller cannot jump.
1 UINavigationController *nav = (UINavigationController *)tabCtl.viewControllers[0];2 ProjectViewController *proCtl = [[ProjectViewController alloc]init];3 [nav pushViewController:proCtl animated:YES];

 

If the application uses a proxy method to prevent tabBar double click, remember to call this proxy method.

 

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.