UISearch bar case sensitive off ? ? ?

Posted by Flodev03 on Stack Overflow See other posts from Stack Overflow or by Flodev03
Published on 2010-03-16T22:31:57Z Indexed on 2010/03/16 23:21 UTC
Read the original article Hit count: 423

Filed under:
|
|
|

hi all, in a table view i have set a UISearchBar set the delegate and add the protocol.

When user tap a word everything is ok exept that the search of "tennis" and "Tennis" is not the same.

How can i make the search bar a non case sensitive UISearchBar, i have search a lot please help it would be great thanks to all here is my code where i think evrything happens :

thanks to all !!!!

- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{

 [tableData removeAllObjects];// remove all data that belongs to previous search

 if([searchText isEqualToString:@""]||searchText==nil){

  [myTableView reloadData];

  return;

 }

 NSInteger counter = 0;

 for(NSString *name in dataSource)

 {

  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];

  NSRange r = [name rangeOfString:searchText];

  if(r.location != NSNotFound)

   [tableData addObject:name];

  counter++;

  [pool release];

 }

 [myTableView reloadData];


}

© Stack Overflow or respective owner

Related posts about uisearchbar

Related posts about case