您的位置:首页 > 其它

解析字典包含关键字比如ID,description等,MJExtension 框架 不能直接设置变量与其同名。

2015-07-03 15:46 155 查看
@property (nonatomic,strong) NSString *descrip; //设置变量名

_DataReceived=(NSMutableArray *)[HZnewsmessage objectArrayWithKeyValuesArray:tempnews];

//上面利用MJExtension框架遍历都是通过变量名与KEY相同的情况,而关键字需要单独遍历

for (int i=0; i<tempnews.count; i++) {

NSDictionary *temp_dic=[tempnews objectAtIndex:i];

HZnewsmessage *temp_mesg=[_DataReceived objectAtIndex:i];

temp_mesg.descrip=[temp_dic objectForKey:@"description"];

[_DataReceived replaceObjectAtIndex:i withObject:temp_mesg];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: