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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:37:50+00:00 2026-06-01T01:37:50+00:00

I would like to ask a question. Now i am training in iOS with

  • 0

I would like to ask a question.
Now i am training in iOS with UISearchBar , TableView and Sqlite.
I have sqlite database and i want to search data from that sqlite database and then i want to show that search data in tableView.
I already select data into NSMutableArray named myArray in ViewDidLoad Event like following code.

- (void)viewDidLoad
{
    [super viewDidLoad];

    MyInfo *myInfo = [[MyInfo alloc] init];
    myArray = [myInfo getInitialData]; // myArray is my NSMutableArray's variable name and getData From getInitialData Method.

    [tableData addObjectsFromArray:myArray]; // tableData is my next NSMutableArray's variable name that i want to show search data in tableView.
}

like that.I added data from myArray into tableData.
and then i write some of code in UISearchBar’s textDidChange Events following like that.

- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
    if([searchText isEqualToString:@""] || searchText==nil)
    {
        [myTableView reloadData];
        return;
    }

    NSInteger counter = 0;
    for(NSString *nameMe in myArray)
    {
        NSRange r = [[nameMe lowercaseString] rangeOfString:[searchText lowercaseString]];
        if(r.location != NSNotFound)
        {
            if(r.location== 0)//that is we are checking only the start of the names.
            {
                [tableData addObject:nameMe];
            }
        }

        counter++;
    }
    [myTableView reloadData];
}

But i can’t search data from database.There was error occurring.
I think i am wrong in my search code.
My column name is “name” that i want to search from database.
However i don’t know how to search data with UISearchBar.
If my codes are wrong,please advice me how to search data from sqlite.
I am just beginner in iOS , please help me.

Best Regards,

  • 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-01T01:37:51+00:00Added an answer on June 1, 2026 at 1:37 am

    Here is the Link It is doing exaclty what u want to do. only u have to modify just a bit the table view in the example are filled with plist Element (correct me if i m wrong i used it long time back)

    All u have to do is that fill the Array with the Values from Sqlite Database. I could have shown u that as well but i dont have my mac with me right now

    Do let me know if it worked or u need any other help…!!!!

    Cheeers!!!

    Updated

    Did u allocated ur NSMutatableArray?

    Some thing like

    NSMutableArray *myArray = [[NSMutableArray alloc] init];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to ask a question. Now i'm training about iPhone Programming. I'm
I would like to ask a question on theming in liferay. What would be
Just like Carl's question over here I would like to ask you (because I
I would like to ask a rather, general, high-level introductory kind of question regarding
I know this is a weird question to ask, but I would like to
I would like to ask a question in Titanium mobile. I am finding the
For my first question here I would like to ask you how you'd do
sorry for any inconveniece caused. Would like to ask about database or rather databinding
I would like to ask you guys a question. You see, I know what
The question I would like to ask is if the Javascript snippet below is

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.