Reputation: 6986
I have an iPhone app based around a UINavigationController
with a UIToolbar
at the bottom with various buttons in it that I created through the Interface Builder. When I use [navigationController pushViewController:animated:]
my new view slides into place as expected but then all of the buttons are disappearing from the toolbar - the toolbar itself stays visible, it's just completely empty.
How do I get the buttons to stay put?
Here's the bit where I respond to the user pressing one of the toolbar buttons that then shows the new view:
- (IBAction)clickSettings:(id)sender {
NSLog(@"Clicked on 'Settings' button");
SettingsViewController *settingsViewController = [[SettingsViewController alloc] initWithNibName:@"Settings" bundle:nil];
[navigationController pushViewController:settingsViewController animated:YES];
}
Upvotes: 4
Views: 2296
Reputation: 6986
To actually keep the toolbar from one view to the next, you can copy the toolbarItems
property from one UIView
to the next.
Upvotes: 2
Reputation: 303
The tool bar buttons are the property of a given view; when you push a new view on to the navigation stack, the tool bar buttons of the new view will slide in to place.
The tool bar itself seems to "belong" to the navigation controller; visibility of the toolbar is controlled by the UINavigationController toolbarHidden property, i.e.,
self.navigationController.toolbarHidden = YES;
Upvotes: 4