2011年3月9日 星期三

[iOS Dev] Filter FetchedResultsController with NSPredicate

NSPredicate *predicate = [NSPredicate predicateWithFormat:
[NSString stringWithFormat:@"(firstName like '%@')", @"Hank"]];

NSArray *items = [fetchedResultsController.fetchedObjects filteredArrayUsingPredicate:predicate];
 
 for (NSManagedObject *o in items) {
  NSLog(@"%@", o);
 }
Related Posts Plugin for WordPress, Blogger...