Search code examples
iosuinavigationcontrollerback-button

iOS custom back button - remove text and use custom image


I'm trying to implement a custom back button in my app. I don't want a "back" title or whatever the title of the previous VC was. Instead I'd like it simply to look like the attached image for all VCs.

I've tried using setBackButtonBackgroundImage on UIBarButtonItem's appearance proxy which replaces the image but it's still showing the "back" label and I'm not sure how to get rid of it.

Does anyone have any advice for the best practice to implement this? Do I need some kind of UINavigationController subclass? Or do I still need to go the setLeftBarButtonItem with custom back method route that I've seen people use in the past (seems hacky)? Any help would be greatly appreciated.

custom back button image


Solution

  • Try putting an UIButton as a subview in the in the leftBarButtonItem with an action and the image you want and everything will be fine :) ( you might need to edit them a bit but that shouldn't rocket science :P)