views:

115

answers:

2

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)

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
Yes, unfortunately the UINavigationBar does not allow the addition of BarButtonItems, as I said in my question.
Drew C
[self.navigationController setToolbarHidden:NO animated:NO];This will enable the 'toolbar', which is different from 'navigation bar'
sujee
http://stackoverflow.com/questions/2611997/ipad-title-bars-navbars-or-toolbars
sujee
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
+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
Thanks a lot Drew your idea works
RVN