您的位置:首页 > 其它

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;

}

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