iOS team Development-uitabbarcontroller integrates multiple storyboard controllers

Source: Internet
Author: User

In a tabbarcontroller, how do you integrate controller pages from multiple storyboard?

Why is there more than one storyboard? In a project developed by many people, depending on the functional business module, multiple storyboard can be used, each storyboard complete the controller or other view of its own module: After the last finish, You only need to find the corresponding storyboard, and then find the controllers you need in the storyboard:

So how do you integrate 3/or more storyboard controllers pages onto a Tabbar?

Directly on the code, slowly explain:

1. First create a class that inherits from

Uitabbarcontroller

  tabbarcontroller.h//  aiyu////  Created by Http://blog.csdn.net/yangbingbinga on 14/10/24.//  Copyright (c) 2014 Http://blog.csdn.net/yangbingbinga. All rights reserved.//#import <UIKit/UIKit.h> @interface tabbarcontroller:uitabbarcontroller@end
2. Implementation file:

tabbarcontroller.m//aiyu////Created by Http://blog.csdn.net/yangbingbinga on 14/10/24.//Copyright (c) 2014 HT Tp://blog.csdn.net/yangbingbinga. All rights reserved.//#import "TabBarController.h" @interface Tabbarcontroller () @end @implementation    tabbarcontroller-(void) viewdidload {[Super viewdidload]; Nsmutablearray *vcs=[nsmutablearray arraywithcapacity:3];//Create an array to hold the Controller object Uistoryboard *main=[uistoryboard s toryboardwithname:@ "Main" Bundle:[nsbundle mainbundle]];/first find the corresponding storyboard Uistoryboard *main1=[uistoryboard    storyboardwithname:@ "Main1" Bundle:[nsbundle Mainbundle];            Uistoryboard *main2=[uistoryboard storyboardwithname:@ "Main2" Bundle:[nsbundle Mainbundle]; Uiviewcontroller *vc1=[main instantiateviewcontrollerwithidentifier:@ "Xiaoenai"];// Locate the controller Uiviewcontroller *vc2=[main1 instantiateviewcontrollerwithidentifier:@ According to the StoreID of the storyboard and controller.    Xinqing "]; Uiviewcontroller *vc3=[main2 instantiateviewcontrollerwithidentifier:@ "Miyu "];    [VCs ADDOBJECT:VC1];    [VCs ADDOBJECT:VC2];        [VCs ADDOBJECT:VC3]; [Self Setviewcontrollers:vcs animated:no];//replaces the viewcontrollers array of the original Tabbarcontrolle with the current Viewcontroller array} @end
Of course, before using these statements, you need to set an identifier for Viewcontroller:

See:

Original source http://blog.csdn.net/yangbingbinga/article/details/43106235





iOS team Development-uitabbarcontroller integrates multiple storyboard 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.