on didFinishLaunchingWithOptions puts this code:
UITabBarController *tabBarContr = (UITabBarController *)self.window.rootViewController; CGFloat tabBarItemWidth = self.window.rootViewController.view.bounds.size.width / tabBarContr.tabBar.items.count; CGFloat tabBarItemHeight = CGRectGetHeight(tabBarContr.tabBar.frame); UIView *selectedBottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tabBarItemWidth, tabBarItemHeight)]; CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.colors = [NSArray arrayWithObjects: (id)[UIColor blueButton].CGColor, (id)[UIColor colorWithRed:0.08 green:0.54 blue:1 alpha:1].CGColor, nil]; gradient.frame = selectedBottomView.bounds; [selectedBottomView.layer insertSublayer:gradient atIndex:0]; UIGraphicsBeginImageContext(selectedBottomView.bounds.size); [selectedBottomView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); tabBarContr.tabBar.selectionIndicatorImage = image; tabBarContr.tabBar.translucent = YES; tabBarContr.tabBar.tintColor = [UIColor whiteColor];
Note. Take an image instead of a gradient
source share