SETUPNSMutableDictionaryからデータを引っ張ると、それは従業員を代表で800以上のNSMutableDictionariesと異なるNSMutableDictionary
私が持っているにNSMutableDictionaryを追加します。私は検索バーを実装しようとしていると私は私の辞書で動作する深刻な問題を抱えています。
最初のForループでは、検索用の辞書が作成され、送信時にその辞書の各従業員を検索しようとしています。私はそれに検索語をすべての辞書を保持するために、新しい辞書に個別の辞書を追加するにはどうすればよい
PROBLEM
? 2番目のforループで
- (void) searchTableView:(UISearchBar *)theSearchBar {
NSString *searchText = theSearchBar.text;
NSMutableDictionary *searchDict = [[NSMutableDictionary alloc] init];
for (NSDictionary *employee in employeeData)
{
[searchDict setValue:employee forKey:[employee objectForKey:kFULLNAME_TAG]];
}
for (NSDictionary *emp in searchDict)
{
NSString *empName = [emp objectForKey:kFULLNAME_TAG];
NSRange titleResultsRange = [empName rangeOfString:searchText options:NSCaseInsensitiveSearch];
if (titleResultsRange.length > 0){
NSLog(@"search result ---> %@" ,emp);
[copyListOfItems setValue:empName forKey:emp];
}
}
}
、私はcopyListOfItemsのsetValueに問題が午前:のempName forKey:EMPを。
悪いことを試してみましょう – zach