RDVTabBarController *tabBar = [RDVTabBarController new];
[tabBar setViewControllers:@[na_home,na_tre,na_pub,na_friend,na_my]];
[self customizeTabBarForController:tabBar];
self.window.rootViewController = tabBar;
- (void)customizeTabBarForController:(RDVTabBarController *)tabBarController{
NSArray *tabBarItemTitle = @[@"首頁",@"財富",@"口碑",@"朋友",@"我的"];
// 選中效果的圖片
NSArray *tabBarItemImgSelect = @[@"zfb_c",@"caifu_c",@"koubei_c",@"friend_c",@"wode_c"];
// 未選效果的圖片
NSArray *tabBarItemImgUnselect = @[@"zfb_nc",@"caifu_nc",@"koubei_nc",@"friend_nc",@"wode_nc"];
int index = 0;
for(RDVTabBarItem *item in [[tabBarController tabBar] items])
{
item.title = tabBarItemTitle[index];
[item setFinishedSelectedImage:[UIImage imageNamed:tabBarItemImgSelect[index]] withFinishedUnselectedImage:[UIImage imageNamed:tabBarItemImgUnselect[index]]];
item.unselectedTitleAttributes = @{
NSFontAttributeName:[UIFont systemFontOfSize:11*kFontScale],
NSForegroundColorAttributeName:rgba(156, 156, 156, 1),
};
item.selectedTitleAttributes = @{
NSFontAttributeName:[UIFont systemFontOfSize:11*kFontScale],
NSForegroundColorAttributeName:[UIColor blueColor],
};
index ++;
}
}