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

  • Home
  • SEARCH
  • 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 8277547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:43:01+00:00 2026-06-08T08:43:01+00:00

I’m trying to implement a searchable tableview in my app, where when someone can

  • 0

I’m trying to implement a searchable tableview in my app, where when someone can search a location and get results. It looks something like this:

enter image description here

I’m getting my source from genomes.com which gives more then just cities, it also has parks, buildings, counties, etc. I want to just show locations which are cities.

The data is a JSON file which is parsed by JSONKit. The whole file comes in (maximum 20 objects) and then the searchable table view shows it. I’m not sure if I should parse the JSON file differently, or if I should make the table view show only the results needed. (Performance in this case is not an issue.). The JSON file gets converted to an NSArray.

Here is part of the array:

 {
    adminCode1 = MA;
    adminCode2 = 027;
    adminName1 = Massachusetts;
    adminName2 = "Worcester County";
    adminName3 = "";
    adminName4 = "";
    adminName5 = "";
    continentCode = NA;
    countryCode = US;
    countryName = "United States";
    elevation = 178;
    fcl = A;
    fclName = "country, state, region,...";
    fcode = ADMD;
    fcodeName = "administrative division";
    geonameId = 4929431;
    lat = "42.2000939";
    lng = "-71.8495163";
    name = "Town of Auburn";
    population = 0;
    score = "53.40083694458008";
    timezone =         {
        dstOffset = "-4";
        gmtOffset = "-5";
        timeZoneId = "America/New_York";
    };
    toponymName = "Town of Auburn";
},

What I want to do is if the “fcl” (seen in the array) is equal to P, then I want it to show that in the table view. If the “fcl” is some other character, then I don’t want it to be seen in the table view. I’m pretty sure that an if statement can do that, but I don’t know how to get it so that it filters part of it.

Any help would be appreciated! Thanks

EDIT: As of now, this is the code to search:

    - (void)delayedSearch:(NSString*)searchString
{
    [self.geoNamesSearch cancel];
    [self.geoNamesSearch search:searchString
                        maxRows:20
                       startRow:0
                       language:nil];
}

- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
    self.searchDisplayController.searchBar.prompt = NSLocalizedStringFromTable(@"ILGEONAMES_SEARCHING", @"ILGeoNames", @"");
    [self.searchResults removeAllObjects];

    // Delay the search 1 second to minimize outstanding requests
    [NSObject cancelPreviousPerformRequestsWithTarget:self];
    [self performSelector:@selector(delayedSearch:) withObject:searchString afterDelay:0];

    return YES;
}
  • 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-08T08:43:03+00:00Added an answer on June 8, 2026 at 8:43 am
    NSMutableArray* filtered = [[NSMutableArray alloc] autorelease];
    
    for (int i=0;i<[data count];i++)
    {
       NSDictionary* item=[data objectAtIndex:i];
    
       if (@"P" == [item objectForKey:@"fcl"] )
      {
        [filtered addObject:item];
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace

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.