我有一个模型对象Place
,它具有一些标准属性。它还在Mogenerated
子类中定义了一些自定义实例方法。看起来是这样的:
- (NSString *) currentName {
return [self valueFromArrayData:self.nameLocaleMap atIndex:...];
}
我想知道是否有可能让一个NSpredicate
在某种程度上起到这样的作用:
// I have tried this predicate, and it doesn't work... IS it possible to do something similar to get the wanted effect?
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"currentName CONTAINS[cd] %@", searchText];
或者,如果有可能计算/比较NSData
属性的内容和NSString?
发布于 2014-02-13 02:07:01
您的谓词应该工作,但只在本地运行时,例如,一个数组(filteredArrayUsingPredicate:
)。
您的谓词不能与核心数据一起使用,因为currentName
不存在于数据存储级别。
https://stackoverflow.com/questions/21750898
复制