@interface MainVC : UITabBarController<UITabBarControllerDelegate>
@end
- (void)viewDidLoad
{
[super viewDidLoad];
if (SystemVersion > 6.0)
[UITextField appearance].tintColor = [UIColor grayColor];
[[UITabBar appearance] setTintColor:kBtnNomalColor];
//初始化控制器
PatientMainVC * patientVC = [[PatientMainVC alloc]init];
MessageListVC * messageListVC = [[MessageListVC alloc]init];
ToolVC * toolVC = [[ToolVC alloc]init];
// PersonalVC * personalVC = [[PersonalVC alloc]init];
PersonalPageVC * personalVC = [[PersonalPageVC alloc]init];
NSArray * ctrArray = [[NSArray alloc]initWithObjects:patientVC,messageListVC,toolVC,personalVC, nil];
self.viewControllers = ctrArray;
self.selectedViewController = patientVC;
self.tabBar.layer.borderWidth = 0.5;
self.tabBar.layer.borderColor = kNavBottomColor.CGColor;
self.tabBar.layer.backgroundColor = kNavColr.CGColor;
[self.tabBar setClipsToBounds:YES];
[self.tabBar setTintColor:kNavColr];
// [self.tabBar setBackgroundColor:[UIColor purpleColor]];
//初始化tabBar
UITabBar *tabBar = self.tabBar;
UITabBarItem *aTabBarItem = [tabBar.items objectAtIndex:0];
UITabBarItem *bTabBarItem = [tabBar.items objectAtIndex:1];
UITabBarItem *cTabBarItem = [tabBar.items objectAtIndex:2];
UITabBarItem *dTabBarItem = [tabBar.items objectAtIndex:3];
aTabBarItem.title = @"病人";
bTabBarItem.title = @"消息";
cTabBarItem.title = @"工具";
dTabBarItem.title = @"我";
[aTabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"patient_selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"patient_default"]];
[bTabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"message_selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"message_default"]];
[cTabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"tool_selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"tool_default"]];
[dTabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"mine_selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"mine_default"]];
// UIImage* tabBarBackground = [UIImage imageNamed:@"tabbarbg.png"];
// [[UITabBar appearance] setBackgroundImage:[tabBarBackground resizableImageWithCapInsets:UIEdgeInsetsZero]];
// [[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"tabbar_selected.png"]];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor grayColor], UITextAttributeTextColor,nil] forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
kBtnNomalColor, UITextAttributeTextColor,nil] forState:UIControlStateSelected];
}