zoukankan      html  css  js  c++  java
  • self.navigationbar的设置总汇

    //隐藏与显示

    self.navigationController.navigationBar.hidden = YES;

    self.navigationController.navigationBarHidden = YES;//这个设置没有侧滑的动画

    //navigationBar的透明问题

    [self.navigationController.navigationBar setBackgroundImage:[UIImage new]
    forBarMetrics:UIBarMetricsDefault];//给navigationBar设置一个空的背景图片即可实现透明,而且标题按钮都在

    self.navigationController.navigationBar.shadowImage = [UIImage new];
    //其实这个线也是image控制的。设为空即可

    //navigationBar是一个复合视图,它是有许多个控件组成的,那么我们就可以从他的内部入手
    [[self.navigationController.navigationBar subviews] objectAtIndex:0].alpha = 0;//这里可以根据scrollView的偏移量来设置alpha就实现了渐变透明的效果

    //3、全局设置navigationBar标题的样式和barItem的标题样式

    //UIColorWithHexRGB( )这个方法是自己定义的,这里只需要给个颜色就好了
    [[UINavigationBar appearance] setBarTintColor:UIColorWithHexRGB(0xfefefe)];

    [[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:UIColorWithHexRGB(0xfe6d27)}];

    [[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:10],NSForegroundColorAttributeName : UIColorWithHexRGB(0x666666)} forState:UIControlStateNormal];

    [[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSiz

    //5、侧滑手势返回

    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
    //需要遵循一下手势的代理 self.navigationController.interactivePopGestureRecognizer.delegate = self;
    self.navigationController.interactivePopGestureRecognizer.enabled = YES;

    //问题:当返回navigationController的最顶层的Controller的时候。再次侧滑,这个时候你在点击一个push页面的操作,你会发现卡那了,半天才会有反应。
    这是由于,在最顶层Controller手势依然有效,但是滑动后,并找不到返回的页面。造成软件卡顿,假死所以就要在rootViewController中让此手势失效。把下面的设为NO

    self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    }

  • 相关阅读:
    基于【 Docker】四 || Docker常用镜像安装
    【静态延迟加载】self关键字和static关键字的区别
    【php设计模式】单例模式
    为什么要使用 SPL中的 SplQueue实现队列
    php中连接tcp服务的三种方式
    使用rsync工具构建php项目管理平台
    php 求两个数组的差集应该注意的事情
    lnmp环境快速搭建及原理解析
    nginx + lua 限制ip地址访问
    mysql主从复制搭建
  • 原文地址:https://www.cnblogs.com/lsh1234/p/7449198.html
Copyright © 2011-2022 走看看