- 第一步:首先将返回按钮的图片设为自定义的图片
UIImage *image = [UIImage imageNamed: @"ic_default_back"];
UINavigationBar *navigationBar = self.navigationController.navigationBar;
navigationBar.backIndicatorImage = image;
navigationBar.backIndicatorTransitionMaskImage = image;
navigationBar.tintColor = [UIColor color_0x262626];
- 第二步:将放回按钮的文字设置到最小,并且让字体透明,这样就达到了隐藏返回按钮文字的效果
UIBarButtonItem *item = [UIBarButtonItem appearance];
NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:0.001],
NSForegroundColorAttributeName: [UIColor clearColor]};
[item setTitleTextAttributes: attributes
forState: UIControlStateNormal];
多说一句: [UIBarButtonItem appearance] 这个会修改所有 UIBarButtonItem 的样式,所以请做其它处理。