标签:values value assign str 年龄 核心 sig object 字典
1. self.dataArray= [MJModel mj_objectArrayWithKeyValuesArray:data[@"resultMessage"][@"result"]];//data[@"resultMessage"][@"result"]解析出来的数组 /* 和上边的方法作用相同 NSArray *array=data[@"resultMessage"][@"result"];//解析出来的数组
for (NSDictionary *dic in array) {
MJModel *modle=[MJModel mj_objectWithKeyValues:dic];
[self.dataArray addObject:modle]; } */ 2. NSArray * shopsArray = [shopModel objectArrayWithFilename:@"1.plist"]; [self.shops addObjectsFromArray:shopsArray];
mj_objectWithKeyValues:
@interface User : NSObject @property (copy, nonatomic) NSString *name;/* 姓名 */ @property (assign, nonatomic) unsigned int age;/* 年龄 */ @end //简单的字典 NSDictionary *dict_user = @{ @"name" : @"Jack", @"age" : @20, }; User *user = [User mj_objectWithKeyValues:dict_user];
JSON字符串 --> 模型
// 定义一个JSON字符串 NSString *json = @"{\"name\":\"Jack\", \"icon\":\"lufy.png\", \"age\":20}"; User *user = [User mj_objectWithKeyValues:json];
//其他用法可以参考 http://www.jianshu.com/p/475b28160c89
标签:values value assign str 年龄 核心 sig object 字典
原文地址:http://www.cnblogs.com/Lrx-lizi/p/6882338.html