BaceModel

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;

    }

 

}

posted @ 2016-04-03 12:30  浪味小仙女  阅读(128)  评论(0编辑  收藏  举报