iPhone Dev - Is it possible to remove a button from a UINavigationController's navigationBar?
When I push a view via my app's navigationController, it automatically puts a back button on the left side of the navigationBar.开发者_StackOverflow Is there any way I can just remove this? (I want to put my own buttons on the screen that will allow the view to be popped).
From the comments, you can hide the back button for a viewController by using its navigationItem property. (which is the UINavigationItem corresponding to that viewController in the stack of the navigationController. its how you control what shows up on the bar for specific view controllers (see Apple Doc here)).
To answer your question, set the navigationItem's hidesBackButton
property to YES
. Something like this probably called in your viewControllers viewDidLoad:
or similar method.
myViewController.navigationItem.hidesBackButton = YES;
have you try with self.navigationItem.hidesBackButton=YES;
?
If I wanted to do it, I'd hide the Navigation bar on push (non animated hide), add a toolbar, and add any custom stuff I want to the toolbar.
on popping the view controller, make sure to unhide the navigation bar. It'll work
精彩评论