创建一个具有自定义TabBar
的项目,它在iOS
高达9的情况下都可以完美工作,但是在iOS 10
中,我在TabBar
顶部的TabBar
行有问题。
尝试以下代码:
UITabBarController *Tabbar;
[[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];
它的工作是
iOS9
而不是iOS10
。我试图将此应用到
TabBar
1)试试:
[Tabbar.tabBar setShadowImage:[[UIImage alloc] init]];
Tabbar.tabBar.layer.borderWidth = 0.0f;
Tabbar.tabBar.layer.borderColor =[UIColor clearColor].CGColor;
Tabbar.tabBar.layer.backgroundColor=[UIColor clearColor].CGColor;
Tabbar.tabBar.tintColor=CLEAR_COLOR;
Tabbar.tabBar.barTintColor=CLEAR_COLOR;
2)尝试:
CALayer * superLayer = [UITabBar appearance].layer;
CALayer * layer = [CALayer layer];
layer.bounds = CGRectMake (0.0f, 0.0f, 62.0f, 56.0f);
layer.contents = (id) [UIImage imageNamed: @"tras_tabbg-min"].CGImage;
layer.anchorPoint = CGPointMake (0.5f, 1.0f);
layer.position = CGPointMake (superLayer.bounds.size.width / 2.0f, superLayer.bounds.size.height);
layer.zPosition = 1.0f;
[[UITabBar appearance].layer addSublayer: layer];
3)试试:(使应用程序崩溃)
[self.tabBar setValue:@(YES) forKeyPath:@"_hidesShadow"];
* 4)尝试:*
[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"yourImageName"]];
[UITabBar appearance].layer.borderWidth = 0.0f;
[UITabBar appearance].clipsToBounds = true;
输出:
我也想要边境听证会。这是背景图片。
注意:我希望标签栏上的背景图片不是nil或clear
如果有任何解决方案,请回复。
最佳答案
如果> = iOS 10
tabBar.barStyle = UIBarStyle.black
其他
tabBar.shadowImage = UIImage()
tabBar.backgroundImage = UIImage()
关于ios - 如何在iOS10中的TabBar上删除行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40864187/