soh*_*hil 1 objective-c uitabbarcontroller uitabbar ios ios10
Createa定制项目TabBar,在其工作完美iOS多达9个,但iOS 10我有一个问题TabBar上的顶线TabBar。
尝试了以下代码:
UITabBarController *Tabbar;
[[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];
Run Code Online (Sandbox Code Playgroud)
它的工作在iOS9not in 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;
Run Code Online (Sandbox Code Playgroud)
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];
Run Code Online (Sandbox Code Playgroud)
3)尝试:(使应用程序崩溃)
[self.tabBar setValue:@(YES) forKeyPath:@"_hidesShadow"];
Run Code Online (Sandbox Code Playgroud)
*4) 尝试:*
[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"yourImageName"]];
[UITabBar appearance].layer.borderWidth = 0.0f;
[UITabBar appearance].clipsToBounds = true;
Run Code Online (Sandbox Code Playgroud)
输出 :
我也想听边境。这是一个背景图像。
注意:我想要标签栏上的背景图像它不是零或清晰
如果有任何解决方案,请回复。
小智 5
如果 >= iOS 10
tabBar.barStyle = UIBarStyle.black
Run Code Online (Sandbox Code Playgroud)
否则 < iOS 10:
tabBar.shadowImage = UIImage()
tabBar.backgroundImage = UIImage()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1169 次 |
| 最近记录: |