UIToolbar and UINavigationController

Discussion in 'iOS Programming' started by Korolen, Jul 13, 2008.

  1. Korolen macrumors newbie

    Mar 6, 2008

    As far as I can see, Apple has provided no easy way to integrate a UIToolbar at the bottom of the screen. As opposed to UITabBarController which is easy to place on the bottom of the screen and have tied to view controllers, UIToolbar is a normal view just like a UIButton or UISwitch. Thus, it must be manually placed at the bottom of the screen by placing it on a UIView in the view hierarchy.

    This is not especially hard, but is definitely messy. And it only gets worse when coupled with a UINavigationController. I have three levels of drilling in: Categories, Items, and then Item Details. The toolbar should remain stationary when transitioning from Categories to Items, but should slide away with the Items when transitioning from Items to Item Details.

    I believe that Mail used to do this (hiding the toolbar on the Accounts page) prior to 2.0. I know of some third-party apps that do this (Things). But the only implementation I can come up with is some serious kludges.

    Does anyone here have any advice for keeping the code and nibs clean and as kludge-free as possible? Do you think that the apps out there with this functionality do anything more than simple kludges?

    Thanks for your time,

    – Tom
  2. phxbbrown macrumors newbie

    Jun 20, 2008
    Phoenix, AZ
    There was an earlier thread about this, but I was never able to get it working satisfactorily without attaching the toolbar to the window at the same level as the navigation controller. If you have any luck, I'd love to find out how you did it.


  3. Korolen thread starter macrumors newbie

    Mar 6, 2008
    Well, right now I simply leave the Navigation Controller in IB unattached to anything and pragmatically attach it's view it to the UIView where the toolbar is, which works fine... but as I said, I also need the toolbar to slide away with the view sometimes. For that to happen, I literally move the toolbar from the navigation controller's sibling to the top view controller's view. It's quite a kludge and it introduces a number of bugs... but it does work.

Share This Page