iphone - Adding back button to navigation bar -


I've added a navigation bar for a UIViewController, it has only been displayed with another UIViewController. I have a left-back button that is an arrow-like size, like normal navigation bar to back button. It seems that I can only add a button once through IB. I think that the back button should be programmatically added, any suggestions on how I should do it?

Currently, in the root controller, I just push another UIViewController (ViewB) by doing an addSubView. In Visual B, I want to display the navigation bar. The app looks at, not based on navigation controller.

If you are using navigation controller:

  MyViewController * _myViewController = [[MyViewController alloc] initWithNibName: @ "MyViewController" bundle: zero]; [[Self-Navigation Controller] Push ViewController: _myViewController Animated: Yes]; UIBarButtonItem * _backButton = [[UIBarButtonItem alloc] initWithTitle: @ "back" style: UIBarButtonItemStyleDone target: zero operation: zero]; Self.navigationItem.backBarButtonItem = _backButton; [_backbutton release], _back button = zero; [_myViewController release], _myViewController = zero;  

If you are not using the Navigation Controller, look at the components to create custom bar buttons.


Comments