Question

How can i use NSSearchField for filter data that i load into program with core data ?

i want to do that from code not in interface with binding

(please give me tutorial about it)

Was it helpful?

Solution

There is probably not a more authoritative expert (outside of Apple) on Core Data than the folks at cimgf.com. Here's a tutorial that should help you accomplish exactly what you need.

http://www.cimgf.com/2008/11/25/adding-itunes-style-search-to-your-core-data-application/

EDIT: You can further filter the data without going back to disk by using another NSPredicate on the array. If you have a NSFetchedResultsController called myFetchController and a NSPredicate named myPredicate you can do the following.

NSArray * results = [myFecthController fetchedObjects];
NSArray * filteredResults = [results filteredArrayUsingPredicate:myPredicate];

OTHER TIPS

I think what you're looking for is information on using a predicate with an NSFetchRequest.

See Apple's Documentation on predicate programming.

No? Well have you been to Apple's documentation on search fields?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top