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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:59:56+00:00 2026-06-10T11:59:56+00:00

I have a table view in an iOS application I’m working on, and I

  • 0

I have a table view in an iOS application I’m working on, and I want to load the data and start searching only when the search key on the keyboard is clicked. Presently, it loads the data when I start typing in the search field, however, since there is a lot of data, this creates a lot of lag.

I’ve tried looking online, but most tutorials or examples refer to loading the data immediately or when the user is typing in the search bar.

Any suggestions would be much appreciated, thank you!

UPDATE: SOLVED

[Thanks to Tim & channi’s suggestions]

The code below is the updated solution:

- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
/* loads the file into a dictionary */
    NSString *myFile=[[NSBundle mainBundle] pathForResource:@"test" ofType:@"plist"];

    dict = [[NSDictionary alloc] initWithContentsOfFile:myFile];
    recipes = [dict allKeys];

    NSPredicate *resultPredicate = [NSPredicate
                                predicateWithFormat:@"SELF contains[cd] %@",
                                searchText];

    searchResults = [recipes filteredArrayUsingPredicate:resultPredicate];
}

-(void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
    [self filterContentForSearchText:self.searchBar.text scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]];

/* reloads the searchResults table view with the new data */
    [self.searchDisplayController.searchResultsTableView reloadData];
    [self.searchBar resignFirstResponder];
}

-(void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
{
/* Sets both arrays to nil so main table view is a clean view */
    searchResults = nil;
    recipes = nil;
}
  • 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-10T11:59:57+00:00Added an answer on June 10, 2026 at 11:59 am

    i think you might call -(void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope method in -(void)searchBarSearchButtonClicked:(UISearchBar *)searchBar method

    let me know if it works

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

Sidebar

Related Questions

In iOS apps, we have to register nib files with our table view before
I have a Table View Controller with cells. I want to update the text
My IOS application program have tableview in navigation controller secondview. I want to save
I'm new to iOS and Objective-C. I have an application that displays a table
In my iPad application, i have used UISplitViewController where master view contains table view
One view of my iOS application is a UISearchDisplay. I have designed it as
I'm new to iOS developing, I have a UITableViewController and I want to load
I have a catalogue application in iOS 5 that is downloading data from XML
So I have two TableView in one view of an iOS app. I have
I have table View with grouped style with three sections. Get information from dictionary

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.