常用基本 Model

iOS开发中常用基本 Model


不带数据存储
#import <Foundation/Foundation.h>


@interface CHBaseModel : NSObject/*<NSCoding , NSCopying>*/
/**
*  动态初始化对象
*
*  @param dic 属性字典
*
*  @return 对象
*/
- (id)initWithDic:(NSDictionary *)dic;
/**
*  对象转字典
*
*  注意点:
*  如果属性中包含了非BaseModel的自定义对象需要在调用者Model中重写该方法,对该对象进行处理
*
*/
- (NSDictionary *)toDictionary;
/**
*  对象转JSON字符串
*
*  @return JSON字符串
*/
- (NSString *)toJson;
/**
*  获取所有的属性
*
*  @param class 目标类
*
*  @return 属性名称数组
*/
- (NSArray *)getAllProperties:(Class)class;


@end    

下载地址: BaseModel还未添加


未完

posted @ 2017-03-13 16:41  上水的花  阅读(126)  评论(0编辑  收藏  举报