tabBarController管理多個(gè)Storyboard

self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];

self.window.backgroundColor = [UIColor whiteColor];

// 2.創(chuàng)建TabBarCongtroller

UITabBarController *tab = [[UITabBarController alloc] init];

// 3.加載Storyboard

UIStoryboard *homeVC =[UIStoryboard storyboardWithName:@"Home" bundle:nil];

UIStoryboard *messageVC =[UIStoryboard storyboardWithName:@"Message" bundle:nil];

UIStoryboard *pointVC =[UIStoryboard storyboardWithName:@"Point" bundle:nil];

UIStoryboard *MineVC =[UIStoryboard storyboardWithName:@"mine" bundle:nil];

//3.5 設(shè)置tabBarItem

UINavigationController *homeNav = [homeVC instantiateInitialViewController];

UIViewController *home = homeNav.topViewController;

home.title = @"首頁(yè)";

UINavigationController *messageNav = [messageVC instantiateInitialViewController];

UIViewController *message = messageNav.topViewController;

message.tabBarItem.title = @"消息";

message.tabBarItem.image = [UIImage imageNamed:@"1"];

// 4.創(chuàng)建Storyboard添加到TabBarCongtroller中

tab.viewControllers=@[homeNav,messageNav,pointVC.instantiateInitialViewController,MineVC.instantiateInitialViewController];

// 5.設(shè)置根控制器

self.window.rootViewController = tab;

// 6.顯示W(wǎng)indow

[self.window makeKeyAndVisible];

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • *7月8日上午 N:Block :跟一個(gè)函數(shù)塊差不多,會(huì)對(duì)里面所有的內(nèi)容的引用計(jì)數(shù)+1,想要解決就用__block...
    炙冰閱讀 2,730評(píng)論 1 14
  • 哦吼吼,又研究了幾天,把FMDB這個(gè)封裝好的數(shù)據(jù)庫(kù)搞定了,寫了個(gè)簡(jiǎn)單的例子,基于FMDB的添刪改查操作,界面很一般...
    lichengjin閱讀 669評(píng)論 0 0
  • /* UIViewController is a generic controller base class th...
    DanDanC閱讀 2,051評(píng)論 0 2
  • 作者唯一QQ:228544117。。。。。 =========后面的都要新建一個(gè)文章 AppDelegate.h ...
    CC_iOS閱讀 1,184評(píng)論 0 0
  • 寫過(guò) Java 程序的同學(xué),一般都遇到過(guò) NullPointerException :) —— 為了不拋出這個(gè)異常...
    MiZhou閱讀 66,782評(píng)論 12 87

友情鏈接更多精彩內(nèi)容