UINavigationBar 结构

ε祈祈猫儿з 提交于 2019-12-02 14:54:47

UINavigationBar的结构示意图如下所示:(ios7+)

 

不同的app,对界面的设计风格都不一样,只有精确了解UINavigationBar的结构图,才能很好的使用它

    //config for UINavigationBar

    [[UINavigationBar appearance]  setBackgroundImage:[UIImage imageNamed:@"transparentBg"]

                       forBarPosition:UIBarPositionAny

                           barMetrics:UIBarMetricsDefault];

//setShadowImage 需要和 setBackgroundImage 同时使用才生效

    [[UINavigationBar appearance] setShadowImage:[UIImage new]];

    //设置了BackgroundImage 就不要去设置BackgroundColor了

//    [[UINavigationBar appearance] setBackgroundColor:[UIColor navBackgroundColor]];

    //也可以不用设置BarTintColor

//    [[UINavigationBar appearance] setBarTintColor:[UIColor blackColor]];

    [[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:kNavButtonBackOnImage]];

    [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[UIImage imageNamed:kNavButtonBackImage]];

    

    [[UINavigationBar appearance] setTitleTextAttributes:nil];

    [[UINavigationBar appearance] setTintColor:[UIColor blueColor]];

具体函数的含义查看系统api方法

 

UITabBar的使用也是类似的

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!