BaceModel
2016-04-03 12:30
295 查看
https://github.com/nicklockwood/BaseModel
字典封装成model 自动封装
要求属性的名字与字典一样
不能有对象
如果其中有需要自己封装的对象属性
重写setWithDictionary
-(void)setWithDictionary:(NSDictionary *)dict{
[super setWithDictionary:dict];
//user
self.WBuser = [WeiboUser userWithDictionary:[dict objectForKey:@"user"]];
//retweetWeibo
if ([dict objectForKey:@"retweeted_status"] != nil) {
WeiboModel *retModel = [[WeiboModel alloc] init];
[retModel setWithDictionary:[dict objectForKey:@"retweeted_status"]];
self.retweetedWeiboModel = retModel;
}
}
字典封装成model 自动封装
要求属性的名字与字典一样
不能有对象
如果其中有需要自己封装的对象属性
重写setWithDictionary
-(void)setWithDictionary:(NSDictionary *)dict{
[super setWithDictionary:dict];
//user
self.WBuser = [WeiboUser userWithDictionary:[dict objectForKey:@"user"]];
//retweetWeibo
if ([dict objectForKey:@"retweeted_status"] != nil) {
WeiboModel *retModel = [[WeiboModel alloc] init];
[retModel setWithDictionary:[dict objectForKey:@"retweeted_status"]];
self.retweetedWeiboModel = retModel;
}
}
相关文章推荐
- 如何在字符串中添加双引号?
- 【FFMPEG】ffmpeg 时间戳问题汇总
- 使用Qunit做javascript单元测试
- MySQL官网64位win7版下载
- JAVA异常处理相关面试题
- iOS中UIAppearance使用详解
- Cannot forward after response has beencommitted问题分析及解决
- 【FFMPEG】基于RTP的H264视频数据打包解包类
- HDU 1033
- [leetcode] 340. Longest Substring with At Most K Distinct Characters 解题报告
- IAP15L2K61S2仿真只占引脚不占串口的说明
- hdoj 2027 统计元音 (字符串)
- Highcharts可拖动式图表
- 表单脚本
- 【FFMPEG】使用FFMPEG+H264实现RTP传输数据
- 【机器学习】马克一个机器学习的博客
- hdu 5655 CA Loves Stick(简单题)(Bestcoder #78 1001)
- Linux kernel模块管理相关详解
- 常见问题
- 【FFMPEG】谈谈RTP传输中的负载类型和时间戳