objective c - iphone caching issue - UISearchbar -
i have app uses dynamic forward search using uisearchbar
here does..i have 2 views; (list) & b (detail)
on view a, have uisearchbar user can type , list below gets updated dynamically (uses copied arrays) i.e. external web service api
say scenario, user has type "word" he'll start w list show "wa","wb","wc","wd", etc he'll type 2nd letter o (so search term "wo") list display "wo1","wo2","wo3", etc
at point user has typed wo , clicks on 1 of options in list wo2, he'll taken details abt wo2 clicks there...so again shown wo1, wo2, wo3, ...
now here question..if clicks on wo1, though list showing wo1, wo2, wo3, ...he taken details "wa" (i.e. first item in previous list (i.. @ time of typing 'w' only)
so there seems caching abt previous index value, seems... please me issue.
i using array of things. search result, pushing detail, etc
please, provide code main list's datasource , uisearchdisplaycontroller's datasource.
it seems in tableview:didselectrowatindexpath:
you're getting wrong object , send details controller.
anyway, must switch between tableviews in list view controller right object indexpath:
- (uitableviewcell *)tableview:(uitableview *)atableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [atableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier] autorelease]; } if (atableview == self.searchdisplaycontroller.searchresultstableview) { // configure cell object filtered keyword list } else { // configure cell object unfiltered list } } - (void)tabeview:(uitableview *)atableview didselectrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [self tableview:atableview cellforrowatindexpath:indexpath]; // object according cell , push details controller }
Comments
Post a Comment