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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:09:11+00:00 2026-05-28T01:09:11+00:00

I am trying to implement search for UITableView. First I fill my array of

  • 0

I am trying to implement search for UITableView. First I fill my array of historical periods from DB in – (void)viewDidLoad method.

self.periodsArr=[dbAccsess getPeriods:subCountryID];
self.searchBar = [[[UISearchBar alloc]initWithFrame:
                   CGRectMake(0.0f, 0.0f, 320.0f, 44.0f)] autorelease];
searchBar.delegate=self;
self.tableView.tableHeaderView = self.searchBar;
searchBar.keyboardType=UIKeyboardTypeNumberPad;
self.searchController = [[[UISearchDisplayController alloc]
                          initWithSearchBar:self.searchBar contentsController:self] autorelease];
self.searchController.searchResultsDataSource = self; 
self.searchController.searchResultsDelegate = self;

Then I try to implement method

- (NSInteger)tableView:(UITableView *)utableView numberOfRowsInSection:(NSInteger)section
{
if(utableView==self.tableView)
{
    return [self.periodsArr count];
}
NSPredicate *predicate = [NSPredicate predicateWithFormat:
                          @"period beginswith[c] %@", self.searchBar.text];
filteredItems=[[NSMutableArray alloc]init];
self.filteredItems=[self.periodsArr filteredArrayUsingPredicate:predicate];
return filteredItems.count;

}

And in the View Controller UISearchBarDelegate,UITableViewDataSource,UITableViewDelegate

The strings in the tableCells are beginning with dates like 1789-1798. When I am trying to search the information, the search methods works only for first number…. for example I have a cell with information beginning with number 5. When I type in UISearchBar digit 5, the method returns me the record beginning with 1. When I type two numbers, method returns me ‘no results’. Where’s the problem and where I went wrong?

  • 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-28T01:09:12+00:00Added an answer on May 28, 2026 at 1:09 am

    Well, I solved this issue by myself. I was screwed up in cellForRowAtIndexPath meth.

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

Sidebar

Related Questions

I'm trying to implement a search method, which returns a index of a object
I am trying to implement the depth first search algorithm into my game. I
I am trying to implement a search method in a TreeSet. By using an
I am trying to implement a modified parallel depth-first search algorithm in Erlang (let's
I'm trying to implement search result highlighting for pdfs in a web app. I
I am trying to implement an internal search for my website that can point
I am trying to implement a djapian based full text search for searching user
I've been trying to implement a delete function for a Binary Search Tree but
Trying to implement a UITableView of names similar to the built-in Contacts iPhone app
Am trying to implement a generic way for reading sections from a config file.

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.