objective c - Im using a simple search display controller -


i'm using simple search display controller. i'm getting error have no idea. here code plsss n thanks!!!!!

- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     nsinteger rows = 0;      if([tableview isequal:self.searchdisplaycontroller.searchresultstableview])     {         rows = [self.searchresults count];          }     else     {         rows = [self.allitems count];     }      return rows; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath    *)indexpath {     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"cell"];      if([tableview isequal:self.searchdisplaycontroller.searchresultstableview])     {         cell.textlabel.text = [self.searchresults objectatindex:indexpath.row];     }     else     {         cell.textlabel.text = [self.allitems objectatindex:indexpath.row];     }      return cell;     nslog(@"the contents of cell :%@",cell.textlabel.text); }  -(void) filtercontentsforsearchtext:(nsstring *)searchtext scope:(nsstring *)scope {     nspredicate *resultspredicate = [nspredicate predicatewithformat:@"self contains[cd]  %@",searchtext];     self.searchresults = [self.allitems filteredarrayusingpredicate:resultspredicate]; }   //uisearchdisplaycontroller delegate methods - (bool)searchdisplaycontroller:(uisearchdisplaycontroller *)controller    shouldreloadtableforsearchstring:(nsstring *)searchstring {     [self filtercontentsforsearchtext:searchstring scope: [[self.searchdisplaycontroller.searchbar scopebuttontitles] objectatindex: [self.searchdisplaycontroller.searchbar selectedscopebuttonindex]]];      return yes; }  -(bool)searchdisplaycontroller:(uisearchdisplaycontroller *) controller shouldreloadtableforsearchscope:(nsinteger)searchoption {     [self filtercontentsforsearchtext:[self.searchdisplaycontroller.searchbar text] scope:[[self.searchdisplaycontroller.searchbar scopebuttontitles] objectatindex:searchoption]];      return yes; } 

the error follows:

2012-03-08 15:37:18.905 searchviewcontroller[1082:fe03] * assertion failure in -[uisearchresultstableview _createpreparedcellforglobalrow:withindexpath:], /sourcecache/uikit_sim/uikit-1912.3/uitableview.m:6072 2012-03-08 15:37:18.907 searchviewcontroller[1082:fe03] * terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'uitableview datasource must return cell tableview:cellforrowatindexpath:'

instead of: uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"cell"];

try this: uitableviewcell *cell = [self.tableview dequeuereusablecellwithidentifier:@"cell"];

search result presents new tableview anyway , case cannot identify previous identifier,since old tableview not in question.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -