Search code examples
iosuinavigationcontrollertitleback-button

Change UINavigationBar back button title


In my application I want to use 'Back' text as back button title for every viewcontroller. I have read so many posts on stackoverflow but got nothing.

I don't want to set leftbarbuttonitem.

Can anyone help me on this simple task.

Thanks,


Solution

  • Do this in the parent view controller not in the child

    Swift

    navigationItem.backBarButtonItem = UIBarButtonItem(title: "Back", style: .plain, target: nil, action: nil)
    

    Objetive-C

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