Search through uisearchbar ,with sqlite.
For example the word “home” written in uisearchbar, be sent to query:
SELECT * FROM table1 WHERE content MATCH ‘…..’ // here ‘….’ to be sent “home”
-(NSArray *)titles{
NSMutableArray * retval = [[[NSMutableArray alloc] init] autorelease];
NSString * query = @"SELECT * FROM table 1 WHERE content MATCH '…..' ";
sqlite3_stmt * statement;
if (sqlite3_prepare_v2(_database, query.UTF8String, -1, &statement, nil) == SQLITE_OK) {
while (sqlite3_step(statement) == SQLITE_ROW) {………..}}};
I want to know if this is possible ,and a link with an example.
Thank you.
You have to make sure your view controller implements the UISearchBarDelegate protocol then add the following method
Modify your titles method to accept a string as parameter:
Make sure your viewcontroller is the delegate for the UISearchBar.