@interface ClassSoftware : NSObject
{
NSString *VerTitle;
NSInteger VerNum;
}
@property (nonatomic, retain) NSString *VerTitle;
@property (nonatomic, readwrite) NSInteger VerNum;
@end
先申明一个classsoftware类,用于NSMutableArray的存储
NSMutableArray *Mysoftware; //定义一个可变数组存储对象
*.m
ClassSoftware *software; //申明类
software=[[ClassSoftware alloc]init]; //开辟空间,若不开辟空间,在xcode中不会报错,运行后才会出现异常。
software.vertitle="22222";
software.vernum=21;
Mysoftware=[[NSMutableArray alloc]init];//初始化数组
[Mysoftware addObject:software];//添加对象到数组
[[Mysoftware objectAtIndex:0]VerTitle] //取值