iPhone toolbar shared by multiple views

Posted by codemonkey on Stack Overflow See other posts from Stack Overflow or by codemonkey
Published on 2010-05-27T23:40:26Z Indexed on 2010/05/27 23:41 UTC
Read the original article Hit count: 240

Another iPhone noob question.

The app I'm building needs to show a shared custom UIToolbar for multiple views (and their subviews) within a UITabBarController framework. The contents of the custom toolbar are the same across all the views. I'd like to be able to design the custom toolbar as a xib and handle UI events from its own controller class (I'm assuming I can subclass UIToolbar to do so?). That way I could define IBOutlet & IBAction items, etc. Then I could associate this custom toolbar with eachs of the UITabBarController views (and their subviews). But I'm having trouble finding out whether that's possible - and if so, how to do it.

In particular, I want to be able to push new views onto UINavigationControllers that are each associated with parent UITabBarController tabs. So, to summarize, I want a:

  • custom toolbar
  • shared by multiple views
  • which are managed by multiple navigation controllers
  • and the navigation controllers are associated with different tabs of a parent tab bar controller

The tab bar controller itself is launched modally, though I don't believe that's relevant.

Anyway, the tab bar controller is working, as are its child navigation controllers. I'm just having a little trouble figuring out how to persist the shared toolbar to the various subviews. I'd settle for a good clean way of implementing programmatically... though I'd prefer the flexibility of keeping the toolbar's visual design in a xib.

Anyone have any suggestions?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c