Reputation: 497
I am using a NavController, but i enabled the toolbar at the bottom. I also added UIBarButtonItem and on the IB, it shows. It basiclly looks like
So the Bar Button was added under Root View Controller, and i can see it in the IB where the Toolbar is, but when i run it, i can see the ToolBar, but not the Item which i called Item1 as its text!
Help
Upvotes: 0
Views: 3815
Reputation: 6458
I've always found it a better idea to deal with a NavigationController's toolbar programmatically rather than in Interface Builder for just these reasons. The steps are
[navController setToolbarHidden:NO animated:YES]
. Sounds like you've done this step.UIBarButtonSystemItemFlexibleSpace
or UIBarButtonSystemItemFixedSpace
to arrange them where you want on the toolbar. Set the array to the toolbar's items
property.No need to subclass anything. Feel free to ask more if this still doesn't work for you.
Upvotes: 3
Reputation: 1522
You need Navigation Controller->ToolBar controller->RootViewContoller if you want to add the Bar button Item at the RootView Controller level.
Otherwise you have subclass the Tool Bar View, set up the IBOutlet for the tool bar button on that and do setButtonText method for the Button text. Then you can include that subclass in your Root View controller and call the setButtonText method.
Upvotes: 0