In my iPad app, I have custom UITabBarItem
images. I set the selected and unselected icons. The selected icon is red, and the unselected icon is the outline of the red icon, but in gray. When a UIModalPresentationSheet
is pulled up, the default behavior of the app is to tint the background gray, along with bar button items and views. However, the active tab bar item remains colored. When I use the default tab bar items, it auto tints to gray. How can I tint my custom tab bar item to match everything else in the background while the modal view is active?
Here is what I use to use my custom image:
appdelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOption {
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *home = [tabBar.items objectAtIndex:0];
home.selectedImage = [[UIImage imageNamed:@"home-active.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
home.image = [[UIImage imageNamed:@"home-inactive.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}