How to add UIToolbar to a NavigationController on Storyboard?
I am not a huge fan of using Interface Builder and for that reason I am new to it.
I am trying to add a UIToolbar to a navigation controller but because Apple documentation is always very clear, I don't have a clue.
I am converting an old project to use Storyboards.
This is what I have done.
after that, a white rectangle appeared at the bottom of the navigation controller on interface builder. I think this is a the UIToolBar or a placeholder. I have tried to drag a BarButtonItem to this "space" and Xcode allowed, showing it like this:
When I run the app, the toolbar shows as a white rectangle at the bottom but not the button.
The button shows like this on the hierarchy:
I suppose the button should be inside the Toolbar item, but Xcode forbids dragging the item there.
How do I make the button show?
The problem here is that your are trying to add an UIToolBar
in a UINavigationController
...
Try in an UIViewController
and that will work !
Edit:
Try this :
You just drag and drop the UINavigationItem on UINavigation RootViewController instead of UIToolbar.
It will allow you to put UIBarButtonItem on that UINavigationItem and works same like UIToolbar Button.
链接地址: http://www.djcxy.com/p/81212.html上一篇: C ++