iphone - UISearchBar Scope Bar Method -


i have uisearchbar in app.and want four scope bars in uisearchbar have given xib file .say one , 2 , 3 , four , problem have 4 array s contains separates values each array ..say array one , array two , array three , array four .

now want when search on pressing scope bar one array one values should search .. on pressing scope bar two array twovalues should search , on ..

is there method scope bar button available search ?

like if( scope_bar==1){...}else

like if search scope barone display array one. there method available ..i searched on apple documentation not get

you should read tutorials nsdictionary . have implemented search on book search app titles , authors searched both @ same time.

// each book

nsdictionary * book = nsdictionary *dict = [nsdictionary dictionarywithobjectsandkeys: title, @"title", author, @"author", nil]; [datasource addobject:book]; 

after in search method can make changes according own ease

- (void)searchbar:(uisearchbar *)searchbar textdidchange:(nsstring *)searchtext {  [tabledata removeallobjects];  if(searchtext != nil && ![searchtext isequaltostring:@""]){      for(nsdictionary * book in datasource){         nsstring * title = [book objectforkey:@"title"];         nsstring * author = [book objectforkey:@"author"];          nsrange titlerange = [[title lowercasestring] rangeofstring:[searchtext lowercasestring]];         nsrange authorrange = [[author lowercasestring] rangeofstring:[searchtext lowercasestring]];          if(titlerange.location != nsnotfound || authorrange.location != nsnotfound)             [tabledata addobject:book];         }  }  [tableview reloaddata]; } 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -