use*_*618 43 objective-c uitabbarcontroller uitabbaritem uitabbar ios
Apple在iOS 7中的tabBar上添加了一条小线,它可以作为tabBar和UI之间的阴影或淡入淡出

因为我使用的是定制的tabBar,所以这条线很刺激.你怎么删除它?请告诉我这是可能的,否则我需要重新设计我的整个应用程序大声笑....
/ 问候
*编辑
使用以下代码行解决了我的问题:
[[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];
Run Code Online (Sandbox Code Playgroud)
小智 22
UIImage* tabBarBackground = [UIImage imageNamed:@"tabbar_bg.png"];
[[UITabBar appearance] setShadowImage:tabBarBackground];
[[UITabBar appearance] setBackgroundImage:tabBarBackground];
Run Code Online (Sandbox Code Playgroud)
sup*_*org 14
这些代码对我来说效果很好(我没有标签栏的背景图片):
[tab_main.tabBar setBackgroundImage:[[UIImage alloc] init]];
[[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];
Run Code Online (Sandbox Code Playgroud)
我也使用这些代码来添加框架:
UIColor* color_green = UIColorFromRGB(0x348e5b);
tab_main.tabBar.layer.borderWidth = 0.50;
tab_main.tabBar.layer.borderColor = color_green.CGColor;
[[UITabBar appearance] setTintColor:color_green];
Run Code Online (Sandbox Code Playgroud)
希望有所帮助.
迅速
简单的解决方案:
在自定义标签栏类中写下以下代码.然后它会隐藏水平阴影线.
self.tabBar.setValue(true, forKey: "_hidesShadow")
Run Code Online (Sandbox Code Playgroud)
目标C.
[self.tabBar setValue:@(YES) forKeyPath:@"_hidesShadow"];
Run Code Online (Sandbox Code Playgroud)
我在 API 中没有看到任何UITabBar影响该分隔符的内容,但如果分隔符位于 UITabBar(UIView 子类)内,我希望您可以在其顶部插入一个新的一像素高的 UIView。您必须抓取想要显示在那里的图像的一部分,并将其绘制在新视图中。我不确定 UITabBar 是否会以某种方式阻止添加子视图或阻止子视图位于顶部。但这就是我要开始的地方。
| 归档时间: |
|
| 查看次数: |
15569 次 |
| 最近记录: |