I have a TableView filled with NSArray containing NSString names of some contacts from address book, in detailTextLabel of cells some information from that contact have to be shown. For every cell, I copy all contacts from addressbook to an array, search the all_contacts array using filteredArrayUsingPredicate
method to find the contact matching the name of current cell, return its RecordID, then get the information to display in detailTextLabel. But it's tooooo slow and TableView will scrolling smoothly.
What is the fastest way to find a contact matching a name?
Asked
Active
Viewed 382 times
0

Hadi Sharghi
- 903
- 16
- 33
1 Answers
1
If you need to search against names a lot, can you keep track of your objects by array and dictionary, you can then use the dictionary to lookup people by name, you will what to wrap these up in a few methods or even class that keeps the two in sync.

Nathan Day
- 5,981
- 2
- 24
- 40
-
If i get it right, I have to keep RecordID as value and name as key in a dictionary? I can do that, but I wanted to know how can I search in addressbook in a faster way than filtering array of all contacts with Predicate? – Hadi Sharghi Sep 05 '11 at 09:03