1. 程式人生 > >iOS開發-tabBar的常見設定

iOS開發-tabBar的常見設定

SecondViewController*secondVC = [[SecondViewControlleralloc]init];
   
UINavigationController *secondnaVC = [[UINavigationControlleralloc]initWithRootViewController:secondVC];
    secondVC.
tabBarItem= [[UITabBarItemalloc]initWithTabBarSystemItem:UITabBarSystemItemBookmarkstag:10000];
    secondVC.
tabBarItem
.badgeValue= @"99+";
   
   
   
   
// 標籤檢視控制器,用來管理導航控制器的 UITabBarController *tabBars = [[UITabBarControlleralloc]init];
   
   
// 設定背景顏色
    tabBars.
tabBar.barTintColor= [UIColorgreenColor];
   
// 設定不半透明
    tabBars.
tabBar.translucent= NO;
   
// 設定選中按鈕的顏色
    tabBars.
tabBar.tintColor= [UIColor
blueColor];
   
   
   
   
// 給標籤控制器指定子控制器
    tabBars.
viewControllers= [NSArrayarrayWithObjects:naVC,firstnaVC,secondnaVC,nil];
   
self.window.rootViewController= tabBars;
    [tabBars
release];