• 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;
    }

  • 相关阅读:
    Codeforces Round #201 (Div. 2)C.Alice and Bob
    1126. Magnetic Storms(单调队列)
    URAL1501. Sense of Beauty(记忆化)
    poj1026Cipher(置换群)
    怎样查看MySql数据库物理文件存放位置
    冒泡排序、选择排序、二分查找排序
    java中的数组的Arrays工具类的使用
    可变参数及其特点
    猜拳游戏项目(涉及知识点Scanner、Random、For、数组、Break、Continue等)
    java中使用nextLine(); 没有输入就自动跳过的问题?
  • 原文地址:https://www.cnblogs.com/lsh1234/p/7449198.html
Copyright © 2020-2023  润新知