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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:08:39+00:00 2026-05-30T13:08:39+00:00

EDIT: Thanks for the answers below. I couldn’t get the UISearchDisplayController to reload the

  • 0

EDIT: Thanks for the answers below. I couldn’t get the UISearchDisplayController to reload the table, so I just ended up calling the filter methods when the search text changed and changing the array used to populate the table.


I’ve added a UISearchDisplayController to a UITableView programmatically as follows (this is using Cocos2d). cellForRowAtIndexPath is originally called when the view loads, but cellForRowAtIndexPath is not called when the search delegates return YES.

(self is a UIViewController)

    table = [[UITableView alloc] initWithFrame:CGRectMake(0.0f, 80.0f, 480.0f, 260.0f)];
    table.delegate = self;
    table.dataSource = self;
    [[[CCDirector sharedDirector] openGLView] addSubview:table];

    UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectZero];
    [searchBar sizeToFit];
    searchBar.delegate = self;
    searchBar.placeholder = @"Search";
    table.tableHeaderView = searchBar;

    UISearchDisplayController *searchDC = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
    searchDC.delegate = self;
    searchDC.searchResultsDataSource = self;
    searchDC.searchResultsDelegate = self;

//        [searchBar release];
//        [searchDC release];

When a character is entered into the search bar, the following delegates are called, numberOfRowsInSection is called, but cellForRowAtIndexPath is never called.

- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
    // Do filtering and add to the search array
}

- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
    [self filterContentForSearchText:searchString scope:[[controller.searchBar scopeButtonTitles] objectAtIndex:[controller.searchBar selectedScopeButtonIndex]]];

    return YES;
}

- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption
{
    [self filterContentForSearchText:[controller.searchBar text] scope:[[controller.searchBar scopeButtonTitles] objectAtIndex:searchOption]];

    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-05-30T13:08:40+00:00Added an answer on May 30, 2026 at 1:08 pm

    Just Check Following things:

    1)tableview delegate & datasource are properly set.

    2)In coming data in not empty.

    3)check method numberOfRowsInSection: returning proper value.

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

Sidebar

Related Questions

UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
Why new()/delete() is slower than malloc()/free()? EDIT: Thanks for the answers so far. Please
edit: many thanks for all the answers. Here are the results after applying the
EDIT: I'm still waiting for more answers. Thanks! In SQL 2000 days, I used
EDIT: Updated thanks to @daroczig's lovely answer below. However, test 2 still feels like
Below is the statement written at http://hateinterview.com/java-script/methods-get-vs-post-in-html-forms/1854.html By specification, GET is used basically for
Please let me know if you have any idea about it. Thanks EDIT What
EDIT : This question duplicates How to access the current Subversion build number? (Thanks
I can't get my images to upload no matter what i do. Below is
EDIT Thanks for the prompt responses. Please see what the real question is. I

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.