關於UITabBarController的設置(iOS 開發)
1.設置圖片(選中以及未選中)
UITabBarItem *TuiJianItem=[[UITabBarItem alloc]initWithTitle:@"我的" image:[[UIImage imageNamed:@"index_bottom07_"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"index_bottom08_"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
2.設置選中狀態字體顏色
[tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"Helvetica-Bold" size:10],
NSFontAttributeName,[UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha
nil] forState:UIControlStateNormal];
3.常規設置
UITabBarController *tabBar=[[UITabBarController alloc]init];
tabBar.viewControllers=@[_homeNav,_erShouNav,_orderNav,_tuiJianNav];
tabBar.view.backgroundColor = [UIColor whiteColor];
tabBar.selectedIndex = 0;//默認展示頁
tabBar.delegate=self;
關於UITabBarController的設置(iOS 開發)