zoukankan      html  css  js  c++  java
  • iOS 同navigationController下 不同vc不同颜色导航栏的push/pop 渐变过渡

    苦于设计师老喜欢在一个app里设置两种不同颜色的vc 风格.

    navigationBar的颜色还能通过把navigationBar的背景设置为透明再在vc中搭颜色

    但navigationBar中的按钮,标题等  都无法很好地独立控制

    除非把navigationBar加在vc中,让vc完全独立控制

    这又失去了iOS 过渡动画的一些特性,看着不爽

    比较理想的是微信的效果,能在push/pop动画中渐变修改不同状态下的颜色来达到不同风格效果

    效果如下

    注意看那个返回按钮的箭头颜色

    于是...

    需每个vc独立控制当前显示navigationBar的颜色配置,可在每个viewWillAppear中使用

        [self.transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
            self.navigationController.navigationBar.tintColor = [UIColor blueColor]; //控制按钮颜色
            self.navigationController.navigationBar.barTintColor = [UIColor orangeColor]; //控制导航栏背景色 按需设置
        } completion:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
        }];
  • 相关阅读:
    topcoder srm 445 div1
    topcoder srm 440 div1
    topcoder srm 435 div1
    topcoder srm 430 div1
    topcoder srm 400 div1
    topcoder srm 380 div1
    topcoder srm 370 div1
    topcoder srm 425 div1
    WKWebView强大的新特性
    Runtime那些事
  • 原文地址:https://www.cnblogs.com/n1ckyxu/p/12096058.html
Copyright © 2011-2022 走看看