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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:44:55+00:00 2026-06-17T13:44:55+00:00

I want to add a search to filter table view. I have an idea

  • 0

I want to add a search to filter table view. I have an idea how to do it, but as my cell is completely custom, i am not sure how to filter by name, and get all the other data from the NSDictionary depending on name.

NSString *name = [searchResults objectAtIndex:indexPath.row];

This returns the name of the cell.textLabel, after filtered correctly, but i need to regain all the information, as in my dictionary:

admin = ;
approved = ;
business = "";
category = ;
description = "";
distance = "";
email = "";
favs = ;
id = ;
image1 = "";
lat = "";
location = "";
lon = "";
name = "";
password = "";
rating = "";
telephone = "";
website = "";

How can i regain all the information above, from just getting the business name, if that makes sense?

  • 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-17T13:44:56+00:00Added an answer on June 17, 2026 at 1:44 pm

    More information is needed, but if I interpret what you’re doing correctly, t seems like you’re extracting the name string from an object, then populating an array with those name strings as a data source for your UITableView. Then you’re trying to work backwards from the name to get the original object.

    If that’s the case, why not just populate the array with the original objects to back the data store, then you can easily get the object by row based on the selected row of the UITableView. You just need to update where you set up the cell contents to pull the name field from the object rather than from a separate array.

    Example:

    // Defined in your class interface:
        NSMutableArray *searchResults = [[NSMutableArray alloc] init];
        NSMutableArray *myArray; // contains all of your objects, could be a dictionary as well
    
    
    - (void) searchTableView {
    
    NSString *searchText = searchBar.text;
    NSMutableArray *searchArray = [[NSMutableArray alloc] init];
    
    [searchArray addObjectsFromArray:myArray];
    
    for (myObject *anObject in searchArray) {
        NSString *objectName = [myObject name];
        NSRange resultsRange = [objectName rangeOfString:searchText options:NSCaseInsensitiveSearch];
    
        if (resultsRange.length > 0)
            [searchResults addObject:anObject];
    }
    
    searchArray = nil;
    }
    
    1. Here we start with an array of all your objects, myArray (if they are stored in a Dictionary, just convert to an array in the next step).

    2. A new array, searchArray, is populated with all of the objects from your main array (as shown) or dictionary (additional conversion).

    3. In the loop, the name field for each object in the searchArray is compared against the text from the searchBar. If the searchBar contents exist within the name field, the object is added to the results array, searchResults.

    4. Use searchResults as the data source for your UITableView, setting the text of each cell to the name of the corresponding object within searchResults. Now each row of the UITableView is directly related to your objects.

    Note that I originally learned this method via the following site. I recommend working through their tutorial – it’s quick and demonstrates some other nice features to use in conjunction with the search setup. Just note that it was written before ARC, so you’ll need to leave out some of the release statements, etc. assuming you’re using ARC.

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

Sidebar

Related Questions

I want to be able to add a Search feature to my table view.
I have a search page and want to add some filters to it, my
Next to file menu i want to add a search menu that will have
I want to add an AutoCompleteTextView in my app and search contacts by name
I want add UIGestureRecognizerDelegate to UIWebView,but failed. if [self.view addsubView:webView]; So UIWebView is ok,but
I have created a table which i want to filter it in two different
I want to filter and search through Json using multiple keywords. I have it
I've created a tridion web site, now i want to add some search control
How can I add a database field to the Magento global search? I want
I want to achieve something like the following: UrlBuilder ub = new UrlBuilder(http://www.google.com/search); ub.Parameters.Add(q,request);

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.