解析字典包含关键字比如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];
}
_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];
}
相关文章推荐
- POJ-1703-Find them, Catch them
- 音乐播放器
- java基础知识随笔--流程控制
- Mysql连接数据库的操作
- Android背景音乐开关示例
- 基于google.zxing的二维码java 代码
- error C2440: ’static_cast’ : cannot convert from ‘UINT (__thiscall CStaticLink::* )(CPoint)’ to ‘LRE
- 为什么手机垃圾就是治不了?
- 使用jquery禁用radio
- 如何让手机横竖屏切换不重走Activity生命周期
- java.util.List接口的方法subList()进行分页
- qt初次使用
- Ubuntu下apt-get
- Entity Framework表名默认自动变为复数形式的解决方法
- 通俗易懂的 C#反射
- LeetCode208:Implement Trie (Prefix Tree)
- 打开VS调试不进入开发的网站直接跳转到主页
- JS参数传值
- DetachedCriteria 如何count数据
- android查看网络图片