Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove line on custom tab bar

I made a custom tab bar with one of them extending beyond the bar. There is a line overlapping the center tab bar. Is there anyway I can get rid or this or hide it?

enter image description here

To do it, I just set tab bar images:

 UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2];


tabBarItem1.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);
tabBarItem3.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);

[tabBarItem1 setFinishedSelectedImage:[UIImage imageNamed:@"scheduleTabBarImageSel.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"scheduleTabBarImage.png"]];
   [tabBarItem3 setFinishedSelectedImage:[UIImage imageNamed:@"favoritesTabBarImageSel.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"favoritesTabBarImage.png"]];
[tabBarItem2 setFinishedSelectedImage:[UIImage imageNamed:@"searchTabBarImageSel.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"searchTabBarImage.png"]];

Any idea how to hide the line? Thanks

like image 382
Spenciefy Avatar asked Sep 01 '13 00:09

Spenciefy


1 Answers

If I'm understanding your correctly, the problem is with the 1-2ish pixel shadow sitting on top of the tab bar. If this is the case, you can remove the shadow the same way you would with a navigation bar. Simply enable clips to bounds.

[self.tabBarController.tabBar setClipsToBounds:YES];
like image 177
Mick MacCallum Avatar answered Oct 20 '22 23:10

Mick MacCallum