ios - UISearchBar results not acting right -
i'm having weird issue after implemented uisearchbar
tableview
. after performing search, results displayed no problem below search bar. when try , select item, item stays highlighted, , doesn't shift screens. if hit cancel results vanish, , table view empty. weird.
but if select item list, hit cancel, searchbar
disappears , results present , can select them , see additional information... whats going on?? i've looked on , can't find solution.
i'm not sure code may acting up, if need example, let me know.
thanks
- (nsinteger)numberofsectionsintableview:(uitableview *)tableview { // return number of sections. return 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { // return number of rows in section. return [gamesearcharray count]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { //static nsstring *cellidentifier = @"cell"; //uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell==nil) { cell = [[uitableviewcell alloc]initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier]; } gamebreakdownarray = [gamesearcharray objectatindex:indexpath.row]; cell.textlabel.text = [gamebreakdownarray valueforkey:@"title"]; cell.detailtextlabel.text = [gamebreakdownarray valueforkey:@"system_title"]; return cell; } - (void)filtercontentforsearchtext:(nsstring*)searchtext scope:(nsstring*)scope { nspredicate *resultpredicate = [nspredicate predicatewithformat:@"name contains[c] %@", searchtext]; gamesearcharray = [gamebreakdownarray filteredarrayusingpredicate:resultpredicate]; }
Comments
Post a Comment