iOS11 设置导航栏的返回按钮只保留箭头,去掉后边的文字


         在 iOS 11 ,之前,为了只显示 返回 图片,而不显示上级界面的标题,可以通过设置导航栏的的属性 

[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)forBarMetrics:UIBarMetricsDefault];

在iOS11上,出现了图片显示异常的现象(UINavigationBarbackIndicatorImage偏下,如下图),所以导致之前的方式不可用.


换一种设计思路

[[UIBarButtonItemappearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName: [UIColorclearColor]}forState:UIControlStateNormal];//将title 文字的颜色改为透明





猜你喜欢

转载自blog.csdn.net/wang_gwei/article/details/78975305