Monday, 26 August 2013

Delete Sync between searchResultsTableView and mainTableView

Delete Sync between searchResultsTableView and mainTableView

I have a simple question and I am looking for most efficient way to deal
with this.
I have a main table (say mainTableView) and it has search bar controlled
by searchResultsTableView.
My main table has a mutable array say mainItems of say 10 items.
When search is performed, the searchResultsTableView may contain say 3
items in different mutable array say searchedItems
now in that search controller I deleted 2 out of 3 items and I also delete
from searchedItems and searchResultsTableView. These are delete 1 at a
time.
So as I delete from searchedItems I also needs to delete from mainItems to
keep in sync but the index would keep changing for every delete in
mainItems so how do I know the original index to be deleted in mainItems?
Should I look for some dictionary based approach instead of array?

No comments:

Post a Comment