【发布时间】:2013-01-14 16:59:32
【问题描述】:
我正在使用 iOS SDK 6.0 和 XCode 4.5.2 开发一个 iOS 应用程序。我的目标开发是 4.3。
我正在使用 Core Data 来管理我的数据。现在我有这个NSPredicate 可以搜索商店:
if ((shopSearchBar.text != nil) && ([shopSearchBar.text length] > 0))
{
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name = %@",shopSearchBar.text];
[fetchRequest setPredicate:predicate];
}
这是商店实体:
我必须将 name 转换为小写,看看它是否包含小写格式的shopSearchBar.text。
例子:
我有这四家店:
- 商店1
- 1号店
- 我的店铺
- 商店
如果用户搜索文本为“shop”,则必须全部返回。
你知道怎么做吗?
【问题讨论】:
标签: ios core-data nspredicate