Here is my plist:
<dict>
<key>ehindi</key>
<string>ankamaal</string>
<key>part</key>
<string>n</string>
<key>meaning</key>
<string>hug</string>
<key>hindi</key>
<string>अंकमाल </string>
</dict>
Here is my code:
- (void)viewDidLoad {
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *finalPath = [path stringByAppendingPathComponent:@"Data.plist"];
NSDictionary *plistData = [[NSDictionary dictionaryWithContentsOfFile:finalPath]
retain];
NSArray *inHidi = [NSArray arrayWithArray:[dict valueForKey:@"hindi"]];
NSDictionary *inHindiDict = [NSDictionary dictionaryWithObject:inHindi
forKey:@"HindiArray"];
NSArray *inEhindi = [NSArray arrayWithArray:[dict valueForKey:@"ehindi"]];
NSDictionary *inEhindiDict = [NSDictionary dictionaryWithObject:inEhindi
forKey:@"EHindiArray"];
[listItem addObject:inEhindiDict];
[listItem addObject:inHindiDict];
copyItem = [[NSMutableArray alloc] init];
/////....
}
I'trying to search key 'ehindi' and display 'hindi' result on my screen. Here What i did to search
- (void) searchTableView {
NSString *searchText = searchBar.text;
NSMutableArray *searchArray = [[NSMutableArray alloc] init];
for (NSDictionary *dictionary in listItems)
{
NSArray *array = [dictionary objectForKey:@"EHindiArray"];
[searchArray addObjectsFromArray:array];
}
for (NSString *sTemp in searchArray)
{
NSRange titleResultsRange = [sTemp rangeOfString:searchText
options:NSCaseInsensitiveSearch];
if (titleResultsRange.length > 0)
[copyItem addObject:sTemp];
}
[searchArray release];
searchArray = nil;
}
I am just able to search 'ehindi'. How can i find the and display the word in 'hindi'. It is not possible to search devnagari and only option I have is to find the index and dispay the value of that index of "EHindiArray".... I will be really happy if someone could help me to solve this problem.