我有一些plist数据,如下图所示:
如果在UIDatePicker
上选择了一个等于CDate的NSDate,我该如何访问“文本”值?
最佳答案
所以你基本上想要
NSString* path = [[NSBundle mainBundle] pathForResource:@"file" ofType:@"plist"];
NSArray* a = [NSArray arrayWithContentsOfFile:path];
for (NSDictionary *d in a)
{
NSString *cdate = [d objectForKey:@"CDate"];
if ([cdate isEqualToString:@"Whatever is currently selected"])
{
NSString *text = [d objectForKey:@"Text"];
// do something with text here
}
}
关于ios - NSDictionary的 list ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12026450/