我制作了一个自定义标签栏,其中一个延伸到栏外.有一条线与中心标签栏重叠.无论如何我可以摆脱这个或隐藏吗?
要做到这一点,我只需设置标签栏图像:
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,-6,0); tabBarItem3.imageInsets = UIEdgeInsetsMake(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"]];
知道如何隐藏线路吗?谢谢
解决方法
如果我正确理解你的问题,问题是坐标栏顶部的1-2英寸像素阴影.如果是这种情况,您可以像导航栏一样删除阴影.只需启用剪辑即可.
[self.tabBarController.tabBar setClipsToBounds:YES];