
model里
@interface ThreeModel : NSObject
@property(nonatomic,strong)NSString *address;
@property(nonatomic,strong)NSString *city;
@property(nonatomic,strong)NSString *detail;
@property(nonatomic,strong)NSString *title;
@end
@interface TwoModel : NSObject
@property(nonatomic,strong)NSArray *list;
@end
@interface Model : NSObject
@property(nonatomic,strong)NSString *reason;
@property(nonatomic,strong)TwoModel *result;
@end
实现里面
@implementation ThreeModel
@end
@implementation TwoModel
// 返回容器类中的所需要存放的数据类型 (以 Class 或 Class Name 的形式)。
+ (NSDictionary *)modelContainerPropertyGenericClass {
return @{@"list" : [ThreeModel class]};
}
@end
@implementation Model
// 返回容器类中的所需要存放的数据类型 (以 Class 或 Class Name 的形式)。
+ (NSDictionary *)modelContainerPropertyGenericClass {
return @{@"result" : [TwoModel class]};
}
@end
本文深入探讨了Objective-C中模型类的设计与实现,包括@interface与@implementation的使用,属性声明及泛型容器类的定义。通过具体示例,如ThreeModel、TwoModel和Model,展示了如何在iOS开发中创建和管理数据模型。

2177

被折叠的 条评论
为什么被折叠?



