How to "Dock" a UIToolbar to the bottom of the screen in UITableView?
Asked Answered
A

1

5

I have a UIToolbar that I added to a UITableViewController in my Storyboard.

Toolbar Location

When this view is displayed, the toolbar will show itself directly below the last item in my UITableView. I want to "Dock" my toolbar on the bottom of the screen. I want it to display in the same place every time rather than move around depending on a variable number of table cells in my view. I need the user to be able to see all the cells as well (It can't be covering UITableView items, UITableView needs to decrease its allotted display space). How can I do this?

Edit: Using a UINavigationController to handle my views

Alathia answered 16/10, 2013 at 20:51 Comment(0)
C
11

You have a couple of options. The first and easiest of the two would be to use a UITableViewController embedded inside a UINavigationController, with the navigation controllers toolbarHidden property set to NO.

The other option is to use a UIViewController. A view controller has a UIView build in, and you can manually add and position a UITableView and a UIToolbar on it in this configuration. Both of these configurations will achieve your desired end result.

Caponize answered 16/10, 2013 at 20:59 Comment(1)
I set toolbarHidden to "NO" on my storyboard, moved my buttons down to the toolbar, and then deleted my old toolbar. Also set bar style to "UIBarStyleBlackOpaque" and setToolBarHidden: "NO" in viewDidLoad and "YES" in all segues out of this view. It all came down to using my UINavigationController toolbar. Thanks for pointing me in the right direction!Alathia

© 2022 - 2024 — McMap. All rights reserved.