1

下の画像のようなplistデータがあります。

ここに画像の説明を入力してください

CDateと等しいNSDateが選択されている場合、「テキスト」値にアクセスするにはどうすればよいUIDatePickerですか?

4

2 に答える 2

12

だからあなたは基本的に欲しい

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
    }
}
于 2012-08-19T13:06:04.233 に答える
1

これに遭遇し、更新が予定されていると思いました

NSDictionary *initialDefaults = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Defaults" ofType:@"plist"]];
于 2015-10-25T15:07:24.610 に答える