- (void)setTabBarItem:(UITabBarItem*)tabbarItem
Title:(NSString*)title
withTitleSize:(CGFloat)size
andFoneName:(NSString*)foneName
selectedImage:(NSString*)selectedImage
withTitleColor:(UIColor*)selectColor
unselectedImage:(NSString*)unselectedImage
withTitleColor:(UIColor*)unselectColor{
//设置图片
tabbarItem = [tabbarIteminitWithTitle:titleimage:[[UIImageimageNamed:unselectedImage]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]selectedImage:[[UIImageimageNamed:selectedImage]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
//未选中字体颜色
[[UITabBarItemappearance]setTitleTextAttributes:@{NSForegroundColorAttributeName:unselectColor,NSFontAttributeName:[UIFontfontWithName:foneNamesize:size]}forState:UIControlStateNormal];
//选中字体颜色
[[UITabBarItemappearance]setTitleTextAttributes:@{NSForegroundColorAttributeName:selectColor,NSFontAttributeName:[UIFontfontWithName:foneNamesize:size]}forState:UIControlStateSelected];
}
[selfsetTabBarItem:homeNC.tabBarItem
Title:@"首页"
withTitleSize:14.0
andFoneName:@"Marion-Italic"
selectedImage:@"orderError"
withTitleColor:[UIColorredColor]
unselectedImage:@"orderSuccess"
withTitleColor:[UIColorwhiteColor]];
网友评论