UITabBar图片取消TintColor和居中显示

选中的图片取消TintColor

1
2
3
4
5
6
7
for (UITabBarItem *item in tabBarController.tabBar.items) {
UIImage *image = item.selectedImage;
UIImage *correctImage =[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
item.selectedImage = correctImage;
}

图片居中显示

1
2
3
for (UITabBarItem *item in tabBarController.tabBar.items) {
item.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);
}