Change UINavigationBar back button title

S S picture S S · Apr 17, 2014 · Viewed 41.2k times · Source

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,

Answer

rustylepord picture rustylepord · Apr 17, 2014

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];