ios 去掉导航navigation Bar底部和 TabBar

2017-04-11  本文已影响0人  FSDemo

去掉线很容易如果没有特殊要求,直接设置透明就没有线了。但这样高斯模糊效果也就没有了,一下是给出的解决方案,去掉线后仍然可以带有高斯模糊
1 、导航条去掉细线相对简单
UIView *backgroundView = [self.navigationBar subviews].firstObject;
UIImageView *navLine = backgroundView.subviews.firstObject;
navLine.hidden=YES;
2、TabBar 去掉线稍微麻烦一点
ios10以前和 ios10以后,其实 ios10以后的解决方案支持 ios10以前版本的,这里都给出,下边直接上代码:

_customTabBar=[[UIView alloc]initWithFrame:CGRectMake(0, -1, self.view.width, 50)];
_customTabBar.userInteractionEnabled=YES;
[self.tabBar addSubview:_customTabBar];
if (IOS10Later) {
     //将系统 tabbar 设置透明
     [self.tabBar setBackgroundColor:[UIColor clearColor]];
       
     //给自定义 tabbar 设置高斯模
     UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
     UIVisualEffectView *effectview = [[UIVisualEffectView alloc] initWithEffect:blur];
     effectview.frame =_customTabBar.bounds;
     [_customTabBar addSubview:effectview]; 
}else{
     [self.tabBar setValue:@(YES) forKeyPath:@"_hidesShadow"];
}
上一篇下一篇

猜你喜欢

热点阅读