Tom Insam

Custom UINavigationController back buttons under iOS7

When you first create / get a reference to the navigation controller, set a global custom back image (replaces the chevron) with:

[self.navigationController.navigationBar setBackIndicatorImage:
    [UIImage imageNamed:@"CustomerBackImage"]];
[self.navigationController.navigationBar setBackIndicatorTransitionMaskImage:
    [UIImage imageNamed:@"CustomerBackImage"]];

The title of the back button is owned by the view that it points to, not the current view. You can make it blank by calling

self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]
    initWithTitle:@""
    style:UIBarButtonItemStylePlain
    target:nil
    action:nil];

in the view that the back button points to. So call it in prepareForSegue or before pushViewController:animated: or something. Setting a view controller’s title programmatically seems to reset it, so set it after setting the title.

You’ll see lots of advice to set self.navigationItem.leftBarButtonItems (which breaks swipe-to-go-back) then mess with interactivePopGestureRecognizer to fix swipe-to-go-back (which has some exciting doesn’t quite work right edge case problems). Don’t do that. Do this.