ios - Displaying two sets of results in one TableViewController -
i know startlingly stupid question, can't figure out. every answer involves uisearchbar, not i've got.
i'm trying display 2 sets of results on 1 tableviewcontroller.
results display
1) everything in managedobjectcontext
set in viewdidload
2) filtered set of results if predicate selected.
on mytableviewcontroller
, have popover instantiates when click uibarbuttonitem
on mytableviewcontroller
. on popover, set predicate on mytableviewcontroller
.
basically, i'd toggle what's displayed , display toggle driven whether variable nil
(everything displays) or filtered (variable sets predicate).
have 2 nsarray properties allvalues
, filteredvalues
. set delegate/datasource properties using filteredvalues
array.
next, when first data:
self.allvalues = [somecontroller fetchallvalues]; self.filteredvalues = self.allvalues; [self.myview.tableview reloaddata];
last, alter filteredvalues
array whether or not predicate selected:
if (self.selectedpredicate) { self.filteredvalues = [self.allvalues filteredarrayusingpredicate:self.selectedpredicate]; } else { self.filteredvalues = self.allvalues; } [self.myview.tableview reloaddata];
Comments
Post a Comment