//设置全局返回按钮
UIImage *backButtonImage = [[UIImage imageNamed:@"arrow-right"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
//适配ios11 返回按钮和导航栏在一条直线上
if(@available(iOS11.0,*)) {
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-200,0) forBarMetrics:UIBarMetricsDefault];
}else{
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)forBarMetrics:UIBarMetricsDefault];
}
网友评论