0

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

enter image description here

rishu1992
  • 1,414
  • 3
  • 14
  • 33
  • 1
    If settings is parent view title, by default it will show like this when using UINavigationBarController. If you need to customize, check this question http://stackoverflow.com/questions/18870128/ios-7-navigation-bar-custom-back-button-without-title – Dileep Mar 11 '15 at 10:13

3 Answers3

1

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.

Nikos M.
  • 13,685
  • 4
  • 47
  • 61
  • I want to add it to a view not view controller – rishu1992 Mar 11 '15 at 10:42
  • I do not see a reason why not using view controllers with navigation controller in order to push views with back functionality but if you want to put it in a uiview you have to implement a custom UIButton and make it look like the default back button. – Nikos M. Mar 11 '15 at 10:44
0

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

self.navigationItem.title = @"Settings";
Suyash Seth
  • 85
  • 1
  • 10
-1

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)
SGDev
  • 2,256
  • 2
  • 13
  • 29