1

我有两个 plist。如何从两个 plist 中添加 NSMutableDictionary 中的信息?我知道如何从 plist 中做到这一点。但我有 2 个 plist。

 NSString *path = [[NSBundle mainBundle] pathForResource:
                          @"Eur" ofType:@"plist"];
        NSString *path1 = [[NSBundle mainBundle] pathForResource:
                          @"Asia" ofType:@"plist"];
        stationDictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:path];

我需要在 stationDictionary 中添加两个 plist:1 Eur 2 Asia。但我不知道如何添加第二个 plist 中的信息?

谢谢!

4

1 回答 1

1
NSString *path = [[NSBundle mainBundle] pathForResource:
                  @"Eur" ofType:@"plist"];
NSString *path1 = [[NSBundle mainBundle] pathForResource:
                   @"Asia" ofType:@"plist"];
NSMutableDictionary* stationDictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:path];
NSDictionary* dicForPath1 = [[NSDictionary alloc] initWithContentsOfFile:path1];
[stationDictionary addEntriesFromDictionary:dicForPath1];
于 2013-04-06T07:59:35.127 回答