读取 对象 plist

从plist中读取 对象

NSString *path = [[NSBundle mainBundle] pathForResource:@"Presidents_a" ofType:@"plist"];
    NSData *data;
    NSKeyedUnarchiver *unarchiver;
    data = [[NSData alloc] initWithContentsOfFile: path];
    unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData: data];
    NSMutableArray *array = [unarchiver decodeObjectForKey: @"Presidents"];
    self.list = array;
    [unarchiver finishDecoding];
    [unarchiver release];
    [data release];
 

plist
读取 对象 plist

你可能感兴趣的:(plist)