我想按城市过滤数据并将其打印到表格部分。我有这样的代码。
NSMutableArray *key1=[NSMutableArray arrayWithCapacity:count];
NSMutableArray *city=[NSMutableArray arrayWithCapacity:count];
NSMutableArray *name= [NSMutableArray arrayWithCapacity:count];
for(id key in data) {
[key1 addObject:key];
}
for (int i=0;i<[key1 count]; i++) {
NSLog(@"key:%@",[key1 objectAtIndex:i]);
}
for (int i=0;i<[key1 count]; i++) {
NSDictionary *email_key=[data objectForKey:[key1 objectAtIndex:i]];
[city addObject:[email_key objectForKey:@"city"]];
[name addObject:[email_key objectForKey:@"f_name"]];
}
我有来自 plist 的城市数组。
我的 Plist 的内容:
<key>bh@gmail.com</key>
<dict>
<key>fnmae</key><string>hello</string>
<key>city</key><string>DElhi</string>
</dict>
<dict>
<key>fnmae</key><string>hi</string>
<key>city</key><string>Bombay</string>
</dict>