In my App there is a Tabbar with four tabs. I add the tabbar icon resources (50x50) into the Images.xcassets
. But I found that one of the icosn displayed incorrect as the following image:
- (void)customTabBarItems{
self.tabBar.superview.backgroundColor = [UIColor whiteColor];
NSArray *items = self.tabBar.items;
NSArray *normalImgs = @[@"tab_home_normal",@"tab_message_normal",@"tab_order_normal",@"tab_userCenter_normal"];
NSArray *selectedImgs = @[@"tab_home_selected",@"tab_message_selected",@"tab_order_selected",@"tab_userCenter_selected"];
for (NSInteger i = 0; i < items.count; i++) {
UITabBarItem *item = [items objectAtIndex:i];
NSString *title = titleArr[i];
UIImage *normalImg = [UIImage imageNamed:normalImgs[i]];
UIImage *selectImg = [UIImage imageNamed:selectedImgs[i]];
item.title = title;
if (isIOS7Later) {
item.image = normalImg;
item.selectedImage = selectImg;
}
else{
[item setFinishedSelectedImage:selectImg withFinishedUnselectedImage:normalImg];
}
}
}
//set tint color
- (void)_customAppearance
{
if (isIOS7Later)
{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
}
UIColor * color = [UIColor whiteColor];
NSDictionary * dict = [NSDictionary dictionaryWithObject:color forKey:UITextAttributeTextColor];
[[UINavigationBar appearance] setTitleTextAttributes:dict];
if (isIOS7Later)
{
[[UITabBar appearance] setTintColor:BGCOLOR(21.0, 170.0, 255.0, 1.0)];
}
else
{
NSDictionary *textAttributesNormal = @{UITextAttributeTextColor: BGCOLOR(179, 179, 179, 1)};
NSDictionary *textAttributesSelected = @{UITextAttributeTextColor:BGCOLOR(0, 154, 255, 1)};
[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"tab_select_image"]];
[[UITabBarItem appearance] setTitleTextAttributes:textAttributesNormal forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:textAttributesSelected forState:UIControlStateSelected];
[[UITabBar appearance] setSelectedImageTintColor:[UIColor whiteColor]];
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"tab_select_image"]];
}
[SVProgressHUD setForegroundColor:BGCOLOR(0, 135.0, 231, 1)];
[SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
}
//Images.xcassets
When I changed the first icon to another, it seems ok, but I want to use this one: