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的使用也是类似的