I want to use a table view as the detail pane in my UISplitViewController. How do I put the toolbar at the top? I want to be able to add bar button items in the same way as my non-table detail views. Thanks.
A:
common paradigm is have UINavigationControllers as the top level controllers for master and detail pages.
So the view hiearchy looks like this (loosly speaking)
- Application Window
- UISplitViewController
- master : UINavigationController
- has your custom Controller (tableView or UIView)
- detail : UINavigationController
- has your custom controller (UITableViewCOntroller / UIVIEWcontroller)
- master : UINavigationController
- UISplitViewController
hope this crude diagram makes sense.
THe perk of having UINavigationController as the top level controller, you get the Toolbar for 'free'.
self.navigationController.toolbar
sujee
2010-06-24 00:10:28
Yes, unfortunately the UINavigationBar does not allow the addition of BarButtonItems, as I said in my question.
Drew C
2010-06-24 07:58:38
[self.navigationController setToolbarHidden:NO animated:NO];This will enable the 'toolbar', which is different from 'navigation bar'
sujee
2010-06-24 16:55:53
http://stackoverflow.com/questions/2611997/ipad-title-bars-navbars-or-toolbars
sujee
2010-06-25 00:21:47
The setToolbarHidden method dispays the toolbar at the bottom, not the top, and it relies on the view being contained in a UINavigationContoller, which mine is not.
Drew C
2010-06-25 06:53:48
+1
A:
My frustration with this problem lay in trying to use the UITableViewController class, which does not allow you to add other UI elements like a toolbar. I solved it by creating a UIViewController object and adding the toolbar and table view to its nib individually. I then had the ViewController implement the table view's delegate and data source methods. Works great.
Drew C
2010-06-25 07:03:25