according to this post for now, Is apple will also reject this code?
and how to implement what apple will approve?
@interface UITabBar (ColorExtensi
Yes, Apple will reject an app if you use that code.
I just had an app rejected for using private API calls. Specifically "_updateView". And I used the exact same code as above.
(If other people say that their app got approved with the same code it's just because it wasn't checked for use of private APIs.)
I suggest instead of changing color why don't you use selected tabbaritem image, like In iOS 6 I have change the selected tabbatitem image like -
in tabbar controller delegate method
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
if([tabBarController selectedIndex] == 0)
{
[viewController.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"selected.png"]withFinishedUnselectedImage:[UIImage imageNamed:@"unselect.png"]];
}
}
through this you can change your image.
Or you can use directly in your view controllers init(or ViewWillAppear) method, like
[viewController.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"selected.png"]withFinishedUnselectedImage:[UIImage imageNamed:@"unselect.png"]];
To set selected color just set:
let tabBarAppearace = UITabBar.appearance()
tabBarAppearace.tintColor = UIColor.nowYouBlue
Above will work for all iOS version currently supported, but to change unselected color:
if #available(iOS 10.0, *) {
tabBarAppearace.unselectedItemTintColor = UIColor.red
} else {
// Fallback on earlier versions
}
Above code will look like this on iOS 10.
[[UITabBar appearance] setSelectedImageTintColor:[UIColor whiteColor]];