1
我想知道当iphone应用程序必须支持多种语言时,如何在目标C中搜索字符串。使用NSPredicate进行搜索时是否自动使用多种语言?
假设我具有搜索功能,看起来像这样目前:
- (int)showSearchResultForQuery:(NSString *)query
{
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name CONTAINS[cd] %@ || address CONTAINS[cd] %@",query, query];
storesFiltered = [[NSMutableArray alloc]initWithArray:[stores filteredArrayUsingPredicate:predicate]];
int count = [storesFiltered count];
if(count > 0)
{
// we have some results
[resultTable reloadData];
}
return count;
}
这段代码基本上接受查询字符串和更新被用于通过使用NSPredicate的表阵列。我想知道,如果这个函数必须接受多种语言,我需要考虑什么?中文。英语...日语...这个功能仍然有效吗?
谢谢。