处理隐藏导航栏底部的横线首先要明白苹果导航栏底部横线用的是UIImageView
2016-01-19 09:22
399 查看
1、声明UIImageView变量,表示底部横线
@property (weak, nonatomic) UIImageView *navBarLine
;
2、从那导航栏中找到地步横线
self.navBarLine =
[self foundNavBarLine:self.navigationController.navigationBar]
;
-(UIImageView *)foundNavBarLine:(UIView *)view{
if ([view isKindOfClass:UIImageView.class]
&& view.bounds.size.height <= 1.0)
{
return (UIImageView *)view;
}
for (UIView *subview in view.subviews)
{
UIImageView *imageView = [self foundNavBarLine:subview];
if (imageView) {
return imageView;
}
}
return nil;
}
3、最后在viewWillAppear,viewWillDisappear中处理
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated]
;
self.navBarLine.hidden = YES ;
}
-(void)viewWillDisappear:(BOOL)animated{
self.navBarLine.hidden = NO ;
}
经过以上三部分处理就可以隐藏导航栏底部的横线了
@property (weak, nonatomic) UIImageView *navBarLine
;
2、从那导航栏中找到地步横线
self.navBarLine =
[self foundNavBarLine:self.navigationController.navigationBar]
;
-(UIImageView *)foundNavBarLine:(UIView *)view{
if ([view isKindOfClass:UIImageView.class]
&& view.bounds.size.height <= 1.0)
{
return (UIImageView *)view;
}
for (UIView *subview in view.subviews)
{
UIImageView *imageView = [self foundNavBarLine:subview];
if (imageView) {
return imageView;
}
}
return nil;
}
3、最后在viewWillAppear,viewWillDisappear中处理
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated]
;
self.navBarLine.hidden = YES ;
}
-(void)viewWillDisappear:(BOOL)animated{
self.navBarLine.hidden = NO ;
}
经过以上三部分处理就可以隐藏导航栏底部的横线了
相关文章推荐
- Android UI线程和非UI线程
- EF框架step by step(9)—Code First Fluent API
- bzoj1570: [JSOI2008]Blue Mary的旅行
- CodeForces 527D Clique Problem
- async = require('async')
- iOS学习笔记5-UIView
- UIView动画——钟表的制作
- IOS学习笔记UI篇
- New UI-带图片(drawableXxx)的TextView
- UICollectionView学习总结
- PHP 统计一维数组value相同的元素的个数num,并将其转化为下标为数字,值是value和num的二维数组
- Android UI集锦——1.Android Drawable分类汇总(1/3)
- Android UI集锦——1.Android Drawable分类汇总(2/3)
- Android UI集锦——1.Android Drawable分类汇总(3/3)
- iOS UIImageView设置为圆形
- iOS开发--一些UINavigationBar属性的设置
- RabbitMQ 3.5.3,guest用户无法远程登陆
- New UI-为TextView设置超链接跳转的三个方法
- Divide and conquer:Matrix(POJ 3685)
- [LeetCode] 187. Repeated DNA Sequences 解题思路