搜索我做一個搜索屏幕(搜索名單)在我的iPhone應用程序,在那裏我需要雙方的姓氏和名字如何通過雙方的名字和姓氏
說我的搜索搜索tableview中包含的名字,像如下
Ravi Kiran
sujay huilgol
harry potter
我的搜索工作,即只有名字,如果我搜索鐳它生病顯示拉維·基蘭但是當我搜索基蘭其不顯示鐳六基蘭
我filterContentForSearchText
是這樣
- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
[self.arrSearhResults removeAllObjects]; // First clear the filtered array.
// Search the main list for Usenames whose type matches searchText; add items that match to the filtered array.
for(NSString * strUserName in arrUserInfo)
{
NSComparisonResult result = [strUserName compare:searchText options:(NSLiteralSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])];
if (result == NSOrderedSame)
{
// Update the filtered array based on the search text and scope.
[self.arrSearhResults addObject:strUserName];
//NSLog(@"arrSearhResults %@",arrSearhResults);
}
}
}
可能有人幫助我,請..... thanx提前!
NSOrderedSame如果接收器和ASTRING的字符串是詞彙值相等。 –