Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to enable the bottom toolbar in a Collection View Controller?

I made and implemented a collection view controller, and now I wish to add a bottom tool bar for navigation purposes. Under the Simulated Metrics tab in the Collection View Controller, I have enabled the bottom toolbar, and it shows up in the storyboard, and I am able to edit and interact with it.

When I run the app in the iPad simulator, the bottom toolbar does not appear. Is there some setting that I am missing that causes it to show in the storyboard and not in the app?

Any suggestions would be appreciated.

like image 806
INsanEWay Avatar asked Mar 26 '13 12:03

INsanEWay


2 Answers

You can embed the UIViewController inside a UINavigationController. In the Storyboard, set the Simulated Metrics for Bottom Bar to one of the Toolbar options on the UINavigationController. You will then notice the Toolbar on the bottom of the UICollectionViewController.

I have done this using Xcode 6.3.2.

like image 172
Tom Avatar answered Nov 09 '22 10:11

Tom


I had the same problem in Interface Builder.

Adding the toolbar programmatically works fine, though:

// viewWillAppear:

// set up toolbar
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height-44, self.view.bounds.size.width, 44)];
toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
[self.view addSubview:toolbar];

// instantiate spacer, middleItem
toolbar.items = @[spacer, middleItem, spacer];
like image 45
Yang Meyer Avatar answered Nov 09 '22 11:11

Yang Meyer