废话不多说,这里简明扼要的介绍一下plist文件的生成与读取
1、创建plist文件
2、代码读取plist文件
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@”myPropertyList” ofType:@”plist”];
//读取出来的可以是数组,也可以是字典
//读取出来的字典
NSMutableDictionary *usersDic = [[NSMutableDictionary alloc]initWithContentsOfFile:plistPath];
//读取出来的是数组
NSMutableArray *usersArray = [[NSMutableArray alloc]initWithContentsOfFile:plistPath];
备注:读取json文件
NSString *path = [[NSBundle mainBundle] pathForResource:@”ServerData.json” ofType:nil];
NSData *data = [[NSData alloc] initWithContentsOfFile:path];
NSMutableDictionary *temp = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];;