0

I have a UINavigationController and when I push one of my views, I have a UINavigationBar on top that I made an ivar for and connected it. Now what I need is that button that is like half square and half arrow on the left of the bar. How would I do this programmatically? All I need it to do is say back and do my back action when it is clicked. How would I do this?

Thanks!

SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
  • 1
    See http://stackoverflow.com/questions/2197698/how-to-set-the-text-of-a-back-button-on-a-uinavigationbar – ott-- Sep 18 '11 at 22:52

1 Answers1

1

If you're using a UINaviationController, then each view controller that you push onto it does not need it's own UINavigationBar object set up in the nib or in code. You get it and a back button 'for free' when you push a view controller onto a navigation controller's stack.

So remove the UINavigationBar from your pushed view controller. It could actually be blocking the navigation controller's navigation bar.

If you're using a nib to set up your view controller, you can add a 'simulated element' so that you have a fake navigation bar in the nib to help lay out your UI elements.

EDIT: in Xcode 4, they're now called 'Simulated Metrics'. Set the 'Top Bar' to simulate a navigation bar in your nib.

enter image description here

MattyG
  • 8,449
  • 6
  • 44
  • 48