ios - Search Controller issue -


- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath** {      static nsstring *cellidentifier = @"tablecell";     tablecell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath];**      // configure cell...      int row = [indexpath row];      cell.titlelabel.text = _title[row];     cell.descriptionlabel.text = _description[row];     cell.feeschedule.text = _fschedule[row];     cell.nonfs.text = _nonfeeschedule[row];     cell.thumbimage.image = [uiimage imagenamed:_images[row]];      if (cell == nil) {         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];     }      cell.textlabel.text = [medicalcodes objectatindex:indexpath.row];     return cell;       if (cell == nil) {         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];     }      if (tableview == self.searchdisplaycontroller.searchresultstableview) {         cell.textlabel.text = [searchresults objectatindex:indexpath.row];     } else {         cell.textlabel.text = [medicalcodes objectatindex:indexpath.row];     }      return cell; }   -(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {       if([[segue identifier] isequaltostring:@"showdetails"]) {         detailviewcontroller *detailviewcontroller = [segue destinationviewcontroller];          nsindexpath *myindexpath = [self.tableview indexpathforselectedrow];          int row = [myindexpath row];         detailviewcontroller.detailmodal = @[_title[row],_description[row],_fschedule[row],_nonfeeschedule[row],_images[row]];     } }  `enter code here`- (void)filtercontentforsearchtext:(nsstring*)searchtext scope:(nsstring*)scope {     nspredicate *resultpredicate = [nspredicate                                     predicatewithformat:@"self contains[cd] %@",                                     searchtext];      searchresults = [medicalcodes filteredarrayusingpredicate:resultpredicate]; }  -(bool)searchdisplaycontroller:(uisearchdisplaycontroller *)controller shouldreloadtableforsearchstring:(nsstring *)searchstring {     [self filtercontentforsearchtext:searchstring                                scope:[[self.searchdisplaycontroller.searchbar scopebuttontitles]                                       objectatindex:[self.searchdisplaycontroller.searchbar                                                      selectedscopebuttonindex]]];      return yes; } 

i have problem, trying search bar work, stoping @ point right here causing app crash. open suggestions ways add search bar better. suggestions on can do? appreciated.

if update data in main thread

or

if reload tableview update ui main thread

             dispatch_async(dispatch_get_main_queue(), ^(void){               [self.tableview reloaddata]              }); 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -