首页 > 其他 > 详细

BaceModel

时间:2016-04-03 13:10:52      阅读:149      评论:0      收藏:0      [点我收藏+]

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;

    }

 

}

BaceModel

原文:http://www.cnblogs.com/huoran1120/p/5349601.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!