iOS 字典转模型
来源:互联网 发布:mac 沙盒路径 编辑:程序博客网 时间:2024/05/18 07:02
提示:代码片断中的<#model#>代表去掉前缀的类名
在.h文件中
- (instancetype)initWithDic:(NSDictionary *)dic;+ (instancetype)<#model#>WithDic:(NSDictionary *)dic;+ (NSArray *)<#model#>List;
在.m文件中
- (instancetype)initWithDic:(NSDictionary *)dic{ if (self = [super init]) { [self setValuesForKeysWithDictionary:dic]; } return self;} + (instancetype)<#model#>WithDic:(NSDictionary *)dic{ return [[self alloc] initWithDic:dic];} +(NSArray *)<#model#>List{ //加载plist NSString *path = [[NSBundle mainBundle]pathForResource:@"<#plistName#>" ofType:@"plist"]; NSArray *dicArray = [NSArray arrayWithContentsOfFile:path]; //字典转模型 NSMutableArray *mutableArray = [NSMutableArray array]; for (NSDictionary *dic in dicArray) { <#className#> *<#model#> =[<#className#> <#model#>WithDic:dic]; [mutableArray addObject:<#model#>]; } return mutableArray;}
0 0
- IOS字典转模型
- ios 字典转模型
- iOS 字典转模型
- iOS 字典转模型
- iOS 字典转模型
- ios-字典转模型
- IOS 学习 字典转模型
- IOS中的字典转模型
- iOS 字典转模型示例
- ios开发--字典转模型
- iOS runtime字典转模型
- IOS之字典转模型
- iOS 字典自动转模型
- iOS 数组/字典转模型
- [IOS笔记]字典转模型
- iOS 字典转模型~方法
- iOS模型设计---字典转模型
- IOS开发UI字典转模型
- MyEclipse + Tomcat 热部署问题
- context:property-placeholder
- POJ 3352 Road Construction
- 【Leetcode】Remove Duplicates from Sorted List II
- 一个优化的查找姓名首字母相同的方法
- iOS 字典转模型
- AFNetworking用法及网络监测
- 极限学习机(Extreme Learning Machine)
- Easyui后台管理界面设计
- 用Swing写个scrapy爬虫图形界面
- Introducing IPython Notebook
- javascript两种禁止一个函数没有运行结束时就再次调用的方法
- 偶有所感
- 昌大软院大神养成计划之网页设计之路第二天