iOS開發-tabBar的常見設定
阿新 • • 發佈:2019-01-04
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];
UINavigationController *secondnaVC = [[UINavigationControlleralloc]initWithRootViewController:secondVC];
secondVC.tabBarItem= [[UITabBarItemalloc]initWithTabBarSystemItem:UITabBarSystemItemBookmarkstag:10000];
secondVC.tabBarItem
// 標籤檢視控制器,用來管理導航控制器的 UITabBarController *tabBars = [[UITabBarControlleralloc]init];
// 設定背景顏色
tabBars.tabBar.barTintColor= [UIColorgreenColor];
// 設定不半透明
tabBars.tabBar.translucent= NO;
// 設定選中按鈕的顏色
tabBars.tabBar.tintColor= [UIColor
// 給標籤控制器指定子控制器
tabBars.viewControllers= [NSArrayarrayWithObjects:naVC,firstnaVC,secondnaVC,nil];
self.window.rootViewController= tabBars;
[tabBars release];