Frage

I have an array which consist of core data class objects. I want to use NSPredicate (for suggestive search) to filter out a particular property of that class.

Requirement I am having a core data classes: AlbumDetails (properties- album name, albumType,etc) i want to access AlbumDetails.AlbumName property using NSPredicate for my search bar text. I currently know using predicate for simple array or dictionary structures, but how can i use predicate for a property of a particular class.

War es hilfreich?

Lösung

You can use something like

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"albumName contains[cd] %@", searchString];

Where albumName is the property of your class. contains will help you to get all the albums whose name contains the searchString

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top