如何从两个plist中添加NSMutableDictionary中的信息?

时间:2013-04-06 07:52:31

标签: ios plist add nsmutabledictionary

我有两个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添加信息?

谢谢!

1 个答案:

答案 0 :(得分: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];