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 9152827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:08:58+00:00 2026-06-17T12:08:58+00:00

I am currently trying to add some search-functionality to my app, but there are

  • 0

I am currently trying to add some search-functionality to my app, but there are some problems, when configuring this. I have a tab-based application with 3 tableviews and I want to add one searchbar for all tableviews. But it seems not that easy to set this up.

The first problem that occurs is that inside the Storyboard-Editor I only can add a separate searchbar to every tableview, but it is not possible to add searchbar to the tabBarController itself. So that the same searchbar is visible over all 3 tableviews.

The Second Problem then is, if I get this some how working, I have to setup a searchDisplayController with 3 different tableviews, but i can initialize a searchDisplayController with just one tableview.

What is the best approach of searching 3 different categories with one searchbar on an iPhone and are there any tutorials out there ? I was also looking at some other apps like facebook, and they are also searching just inside one tableview.

  • 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-06-17T12:09:00+00:00Added an answer on June 17, 2026 at 12:09 pm

    You can use three search display controllers as follows: have each vc on each tab implement a method (and declare it publicly) like this:

    - (void)searchFor:(NSString *)string {
        [self.searchDisplayController setActive:YES];
        self.searchDisplayController.searchBar.text = string;
    }
    

    Each of those should implement this method:

    - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString {
    
        // do the search logic for my table
        // set a badge on my tab indicating how many results I found
    
        // then perform it on the other vcs:
        NSMutableArray *otherVCs = [[self.tabBarController viewControllers] mutableCopy];
        [otherVCs removeObject:self];
    
        for (MyViewController *otherVC in otherVCs) {
            [otherVC searchFor:searchString];
        }
    }
    

    You might need to make sure all your other tab vcs are loaded (if you launch the app, visit just one tab and try this, the other vcs might not be ready. To do that, just insert this line in the loop to force the view to load: (void)[otherVC view];

    (note – this answer presumes ARC)

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

Sidebar

Related Questions

I'm currently trying to add some testing functionality into our builds, and in order
I'm trying to add some functionality from a plugin I have made into a
I'm currently trying to implement searching by following this tutorial. http://www.appcoda.com/how-to-add-search-bar-uitableview/ However, I'm at
Im currently trying to add some Style to my Hyperlinkbutton, but cannot get it
So currently I am trying to add a feature to a userscript I have
I am currently trying to add some parsing methods to a controller method in
Some sample, straight forward gtk2 within-main-loop I'm currently trying to add code at key-press-event
I'm trying to add some syntax highlighting to my blog that currently uses RDiscount.
I am currently trying to create a search based on multiple dropdowns. The snippet
I'm currently trying to add some preferences to a Firefox add-on. To do so,

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.