OC 版
// 设置导航栏返回的图标
// [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:@"xxx"]];
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[UIImage imageNamed:@"xxx"]];
// 隐藏导航栏返回按钮的文字
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];
swift 版
// 设置导航栏返回按钮的图标
// UINavigationBar.appearance().tintColor = UIColor.white
UINavigationBar.appearance().backIndicatorImage = UIImage(named: "xxx")
UINavigationBar.appearance().backIndicatorTransitionMaskImage = UIImage(named: "xxx")
// 隐藏导航栏返回按钮的文字
UIBarButtonItem.appearance().setBackButtonTitlePositionAdjustment(UIOffset(horizontal: 0, vertical: -60), for: UIBarMetrics.default)
以上写在AppDelegate中
网友评论