iOS 设置导航透明的两种方法
来源:互联网 发布:宏观审慎管理知乎 编辑:程序博客网 时间:2024/05/16 02:08
方法一
在当前页面加入下面方法
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
//去掉导航栏底部的黑线
self.navigationController.navigationBar.shadowImage = [UIImage new];
}
如果仅设置当前页导航透明,需加入下面方法- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setShadowImage:nil];
}
方法二
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[[self.navigationController.navigationBar subviews] objectAtIndex:0].alpha = 0;
}
仅设置当前页面
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[[self.navigationController.navigationBar subviews] objectAtIndex:0].alpha = 1;
}
个人感觉:方法二比方法一更为简单,而且效果也好
- iOS 设置导航透明的两种方法
- iOS 设置导航透明的两种方法
- iOS 设置导航透明的两种方法
- ios设置导航条透明的两句代码
- iOS 导航栏设置颜色的两种方法
- iOS 开发导航条的透明设置
- 设置iOS导航栏透明
- 将UINavigationBar设置为全透明的两种方法
- ios设置导航栏透明方法:使用只有一个像素点的透明图片,通过以下代码即可
- iOS 隐藏导航栏底部线的两种方法
- iOS 开发中导航栏渐变的两种方法
- iOS 导航条透明(以及自定义颜色)的方法,去掉导航条底部黑线,随着tableView滚动设置导航条变色
- 设置透明的导航栏
- 透明三角的两种设置方式
- iOS 设置NavgationBar导航条为透明
- iOS 设置导航栏完全透明
- iOS 设置导航栏全透明
- iOS开发-如何设置导航栏透明
- 最小权覆盖问题
- jQuery获取动态id的办法
- h5表单效果 小案例
- 计算机视觉caffe之路第一篇:Ubuntu16.04_Jetson TX1_Caffe_ssd环境配置
- @SuppressWarnings("unchecked")含义
- iOS 设置导航透明的两种方法
- linux相关命令
- leetcode 183. Customers Who Never Order
- Qt之窗口动画(下坠、抖动、透明度)
- java 读写excel文件
- lintcode/leetcode由易至难第13题:Max Consecutive Ones
- nginx日志切割脚本
- ElasticSearch5+logstash的logstash-input-jdbc实现mysql数据同步
- HTML应用推广-自动识别手机系统(Android/iOS)