Back button on navigation bar

123 Views Asked by At

How do I achieve this kind of button? Can I do using navigation bar ?

enter image description here

3

There are 3 best solutions below

2
Nikos M. On

You have to use a UINavigationController. Each time you push a new view controller using:

self.navigationController?.pushViewController(controller, animated: true)

the new controller gets a back button with the previous controller in the stack name.

0
SGDev On

yes you can achieve this by navigationBar. it is very easy in implement by UINavigationBar.

Objective C

// Set this in every view controller so that the back button displays back instead of the root view controller name

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

Swift

self.navigationItem.backBarButtonItem = UIBarButtonItem(title:"", style:.Plain, target:nil, action:nil)
0
Suyash Seth On

Yes you can by giving navigation title in you setting view controller.

self.navigationItem.title = @"Settings";