Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 827659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:36:32+00:00 2026-05-15T03:36:32+00:00

The app I’m building needs to show a shared custom UIToolbar for multiple views

  • 0

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 each 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 UINavigationController view stacks which 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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:36:32+00:00Added an answer on May 15, 2026 at 3:36 am

    I believe I have the “answer”… and it’s so simple, I’m rather embarrassed that it didn’t occur to me before now. Create a custom subclass of UIViewController, within which you set the attributes of the UINavigationController’s toolbar (set as enabled from within the xib in IB). Then, from whichever other views you want that toolbar included, you just subclass that class. In my case, I named a ChallengeToolbar subclass of UIViewController, then I did this:

    UIImage *vaultImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"goldbar" ofType:@"png"]];
    UISegmentedControl *vaultButtonControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:vaultImage, nil]];
    vaultButtonControl.segmentedControlStyle = UISegmentedControlStylePlain;
    vaultButtonControl.momentary = YES;
    [vaultButtonControl addTarget:self action:@selector(goNavVault:) forControlEvents:UIControlEventAllEvents];
    UIBarButtonItem *vaultButton = [[UIBarButtonItem alloc] initWithCustomView:vaultButtonControl];
    vaultButton.customView.frame = CGRectMake(0,0,40,20);
    
    UIBarButtonItem *invite = [[UIBarButtonItem alloc] initWithTitle:@"Invite" style:UIBarButtonItemStyleBordered target:self action:@selector(goNavVault:)];
    
    UIBarButtonItem *flexItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    NSArray *items = [NSArray arrayWithObjects: invite, flexItem, flexItem, flexItem, vaultButton, nil];
    [self setToolbarItems:items animated:NO];
    [vaultButtonControl release];
    [vaultButton release];
    [invite release];
    [flexItem release];
    

    … within the viewDidLoad method. Then, from any view in which I want my toolbar to appear I simply set up the view’s controller class to subclass my ChallengeToolbar class instead of UIViewController. DUH!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My app needs to build a buffer from all the selected cells on a
App:MFC backed by oracle Unit testing framework:googletest I am going to unit testing the
App A has this BroadcastReceiver in its manifest (within <application>): And this receiver: public
We're building an app, our first using Rails 3, and we're having to build
The app I am trying to make needs a few info in the beggining,
My app needs to be able to disconnect from a server and connect to
My app has many controls on its surface, and more are added dynamically at
An app I'm writing always crashes on a clients computer, but I don't get
My app is installed via NSIS. I want the installer to install the program
My app uses a WebRequest at certain points to get pages from itself. This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.