建议写进UINavigationBar的Category便于不同项目复用
[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]]; // 隐藏底部线条
[UINavigationBar appearance].titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]}; // 设置title 颜色
[UINavigationBar appearance].backIndicatorImage =
[UINavigationBar appearance].backIndicatorTransitionMaskImage =
[UIImage templateImageNamed:@"nav_bar_back_icon_white"];
[[UINavigationBar appearance] setBarTintColor:MMA_BLACK(1)];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
// hide title of back button
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
forBarMetrics:UIBarMetricsDefault];
NSShadow *clearShadow = [[NSShadow alloc] init];
clearShadow.shadowColor = [UIColor clearColor];
clearShadow.shadowOffset = CGSizeMake(0, 0);
UIColor *normalTitleColor = [UIColor whiteColor];
UIColor *highlightedTitleColor = [UIColor whiteColor];
[[UIBarButtonItem appearance] setTitleTextAttributes:@{
NSForegroundColorAttributeName : normalTitleColor,
NSShadowAttributeName : clearShadow
} forState:UIControlStateNormal];
[[UIBarButtonItem appearance] setTitleTextAttributes:@{
NSForegroundColorAttributeName : highlightedTitleColor,
NSShadowAttributeName : clearShadow
} forState:UIControlStateHighlighted];
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
[[UIToolbar appearance] setBarTintColor:[UIColor whiteColor]];
网友评论