导航栏全透明效果, 只保留左右两个按钮, 如何实现?以及关于NavigationController的小问题
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forBarMetrics:UIBarMetricsCompact];
self.navigationController.navigationBar.barStyle = UIBaselineAdjustmentNone;
[self.navigationController.navigationBar setShadowImage:[UIImage imageWithColor:[UIColor clearColor]]];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
for (id view in self.navigationController.navigationBar.subviews)
{
if ([view isKindOfClass:NSClassFromString(@"_UINavigationBarBackground")])
{
for (id i in [view subviews])
{
if ([i isKindOfClass:[UIImageView class]])
{
[i removeFromSuperview];
}
}
}
}
[[[[self.navigationController.navigationBar.subviews firstObject] subviews] firstObject] removeFromSuperview];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(add)];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"More" style:UIBarButtonItemStyleDone target:self action:@selector(more)];
+ (UIImage *)imageWithColor:(UIColor *)color
{
CGRect rect = CGRectMake(0, 0, 1, 1);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, color.CGColor);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
//跳转到指定的视图控制器, 注意:要跳转到的视图控制器的对象,必须存在于导航控制器的栈容器中。
//导航控制器的viewControllers属性是一个数组,数组中存放加入导航控制器栈中的所有视图控制器对象,并且数组中对象的下标与对象在栈容器中的位置一致
[self.navigationController popToViewController:[[self.navigationController viewControllers] objectAtIndex:[[self.navigationController viewControllers] count]-4] animated:YES];
导航栏全透明效果, 只保留左右两个按钮, 如何实现?以及关于NavigationController的小问题的更多相关文章
- iOS-导航栏全透明效果, 只保留左右两个按钮以及NavigationController返回几级页面
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor clearCo ...
- iOS 设置导航栏全透明
- (void)viewWillAppear:(BOOL)animated{ //设置导航栏背景图片为一个空的image,这样就透明了 [self.navigationController.navig ...
- ios --xib自定义,解决在导航栏不透明的情况下,自定义xib view高度被压缩64的问题
在使用xib自定义view的时候,个人习惯性的直接使用xib中的约束,所以自然而然的要打开Autolayout.以前在使用的时候没有发现什么问题,最近项目中使用的时候突然发现在导航栏透明的情况下,出现 ...
- self.navigationController.navigationBar.translucent = YES航栏的属性默认 YES是透明效果并且主view不会偏移 NO是导航栏不透明 主view会向下偏移64px
交友:微信号 dwjluck2013 从iOS7开始,苹果对navigationBar进行了模糊处理,并把self.navigationController.navigationBar.translu ...
- Android有趣的全透明效果--Activity及Dialog的全透明(附android系统自带图标大全)[转]
原文地址:http://blog.csdn.net/sodino/article/details/5822147 1.Activity全透明 同学zzm给了这个有趣的代码,现在公布出来. 先在res/ ...
- ViewPager+GridView实现首页导航栏布局分页效果
如图是效果图用ViewPager+GridView实现首页导航栏布局分页效果来实现的效果 Demo下载地址:http://download.csdn.net/detail/qq_29774291/96 ...
- iOS 导航栏 不透明
UINavigationBar.appearance().translucent = false UINavigationBar.appearance().barStyle = UIBarStyle. ...
- Vue 事件监听实现导航栏吸顶效果(页面滚动后定位)
Vue 事件监听实现导航栏吸顶效果(页面滚动后定位) Howie126313 关注 2017.11.19 15:05* 字数 100 阅读 3154评论 0喜欢 0 所说的吸顶效果就是在页面没有滑动之 ...
- 在隐藏导航栏的控制器中,调用UIIMagePickerController,出现导航栏变透明的问题
在隐藏导航栏的控制器中,调用UIIMagePickerController,出现导航栏变透明的问题 解决办法 #pragma mark - UIImagePickerController Delega ...
随机推荐
- spring源码分析的书到了
现在写java后台可以说都能用上spring 在原有的spring基础上,加上自己定制的一些功能,能够使编程变得非常简化. 我也准备在我的毕业设计中写一些spring改造的东西.用来简化开发. 就拿连 ...
- Effective Java 68 Prefer executors and tasks to threads
Principle The general mechanism for executing tasks is the executor service. If you think in terms o ...
- 大写金额字符串生成 C#实现
思路: 中文对金额的描述以四位为一组, 只考虑一万亿以内的数字则每组内以千.百.十和[亿\万\元]区分各位 连续的零按一个处理,组内最低位的零可略去 无角无分说整,有角无分只说角,无角有分说零X分,有 ...
- JSON 格式介绍
转自:http://www.json.org/json-zh.html JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式. 易于人阅读和编写.同时也易于机器 ...
- 基于Cookie的SSO登录分析和实现
什么是SSO? 现在很多大的互联网公司都会有很多的应用,比如以下是淘宝网的截图: 天猫 聚划算 头条等都是不同的应用,有的甚至采用完全不同的域名,但是所有在淘宝注册的用户都是使用的一套用户名和口令,如 ...
- SQL 报错信息整理及解决方案(持续更新)
整理一下自己遇见过的 SQL 各种报错信息及相应解决方法,方便以后查阅,主要平台为 Oracle: ORA-01461: 仅能绑定要插入 LONG 列的 LONG 值: 原因:插入操作时,数据大于字段 ...
- struts2 基本用法
Struts2必需库: commons-fileupload.jar.commons-io-1.3.2.jar.freemarker-2.3.16.jar.javassist-3.7.ga.jar.o ...
- [转]How to insert a row between two rows in an existing excel with HSSF (Apache POI)
本文转自:http://stackoverflow.com/questions/5785724/how-to-insert-a-row-between-two-rows-in-an-existing- ...
- 算法实践——Twitter算法面试题(积水问题)的线性时间解法
问题描述:在下图里我们有不同高度的挡板.这个图片由一个整数数组所代表,数组中每个数是墙的高度.下图可以表示为数组(2.5.1.2.3.4.7.2).假如开始下雨了,那么挡板之间的水坑能够装多少水(水足 ...
- Windows路由表详解
对于路由器的路由表,大部分网管朋友都很熟悉,但是对于windows的路由表,可能了解的人就相对少一些.今天我们就一起来看看windows路由表. 一. windows路由表条目解释 1. 使用ip ...