[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];

iOS-导航栏全透明效果, 只保留左右两个按钮以及NavigationController返回几级页面的更多相关文章

  1. 导航栏全透明效果, 只保留左右两个按钮, 如何实现?以及关于NavigationController的小问题

    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor clearCo ...

  2. iOS 设置导航栏全透明

    - (void)viewWillAppear:(BOOL)animated{ //设置导航栏背景图片为一个空的image,这样就透明了 [self.navigationController.navig ...

  3. iOS 导航栏 不透明

    UINavigationBar.appearance().translucent = false UINavigationBar.appearance().barStyle = UIBarStyle. ...

  4. self.navigationController.navigationBar.translucent = YES航栏的属性默认 YES是透明效果并且主view不会偏移 NO是导航栏不透明 主view会向下偏移64px

    交友:微信号 dwjluck2013 从iOS7开始,苹果对navigationBar进行了模糊处理,并把self.navigationController.navigationBar.translu ...

  5. ios --xib自定义,解决在导航栏不透明的情况下,自定义xib view高度被压缩64的问题

    在使用xib自定义view的时候,个人习惯性的直接使用xib中的约束,所以自然而然的要打开Autolayout.以前在使用的时候没有发现什么问题,最近项目中使用的时候突然发现在导航栏透明的情况下,出现 ...

  6. <iOS 导航栏>第一节:导航栏透明方法实现代码

      说下导航栏的透明方法:   很多应用需要导航栏随着向上滑动,逐渐从透明变成不透明,很炫酷,大部分应用都在使用导航栏渐变效果,现附上代码然后直接将实现,一会讲下如何来实现,这一部分直接上代码.   ...

  7. iOS导航栏的正确隐藏方式【转】

    简介:在项目中经常碰到首页顶部是无限轮播,需要靠最上面显示.有的设置导航栏为透明等一系列的方法,这个可以借助第三方.或者干脆简单粗暴的直接隐藏掉导航栏.可是push到下一个页面的时候是需要导航栏的,如 ...

  8. iOS导航栏的正确隐藏方式

    在项目中经常碰到首页顶部是无限轮播,需要靠最上面显示.有的设置导航栏为透明等一系列的方法,这个可以借助第三方.或者干脆简单粗暴的直接隐藏掉导航栏.可是push到下一个页面的时候是需要导航栏的,如何做了 ...

  9. Android有趣的全透明效果--Activity及Dialog的全透明(附android系统自带图标大全)[转]

    原文地址:http://blog.csdn.net/sodino/article/details/5822147 1.Activity全透明 同学zzm给了这个有趣的代码,现在公布出来. 先在res/ ...

随机推荐

  1. 正则的lastIndex 属性

    简介:正则的lastIndex 属性用于规定下次匹配的起始位置. 注意: 该属性只有设置标志 g 才能使用. 上次匹配的结果是由方法 RegExp.exec() 和 RegExp.test() 找到的 ...

  2. python_面向对象——类之间的依赖关系

    class Dog: def __init__(self,name,age,master): self.name = name self.age = age self.master = master ...

  3. unittest简单使用的介绍

    无论是paython+request接口测试.ui自动化测试等,都常会用到unittest的框架,简单的介绍如下:

  4. 洛谷P1144 最短路计数【堆优化dijkstra】

    题目:https://www.luogu.org/problemnew/show/P1144 题意:问1到各个节点的最短路有多少条. 思路:如果松弛的时候发现是相等的,说明可以经过该点的最短路径到达当 ...

  5. Activiti服务类- FormService服务类

    转自:https://www.cnblogs.com/liuqing576598117/p/9814953.html 1.获取//通过流程定义ID获取表单字段集合StartFormData start ...

  6. ueditor+复制word图片粘贴上传

    Chrome+IE默认支持粘贴剪切板中的图片,但是我要发布的文章存在word里面,图片多达数十张,我总不能一张一张复制吧?Chrome高版本提供了可以将单张图片转换在BASE64字符串的功能.但是无法 ...

  7. [Luogu] 家族

    https://www.luogu.org/problemnew/show/1767 字符串的读入有点麻烦 #include <cstdio> #include <cstring&g ...

  8. 威尔逊定理x

    威尔逊定理 在初等数论中,威尔逊定理给出了判定一个自然数是否为素数的充分必要条件.即:当且仅当p为素数时:( p -1 )! ≡ -1 ( mod p ),但是由于阶乘是呈爆炸增长的,其结论对于实际操 ...

  9. 2019CCPC-江西省赛C题 HDU6569 GCD预处理+二分

    Trap Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Subm ...

  10. openpyxl模块(excel操作)

    openpyxl模块介绍 openpyxl模块是一个读写Excel 2010文档的Python库,如果要处理更早格式的Excel文档,需要用到额外的库,openpyxl是一个比较综合的工具,能够同时读 ...