I have this class:
@interface Item : NSObject {
NSString *name;
NSString *description;
}
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *description;
+ (id)ItemWithDescription:(NSString*)description name:(NSString*)name;
And I am using the following mutable array to keep a complete list of all the items:
@property (strong,nonatomic) NSMutableArray *ItemArray;
With the code below, in the .m file, I insert a new element in the array
[self.ItemArray addObject: [Item ItemWithDescription: @“aDescription” name: @“aName”]];
Till here all is ok, but the problem now is that I don’t know how to extract the element “description
” (as a NSString) of a desired item in the array (let’s say at position [0]). Anyone knows the right syntax to be used?
Aucun commentaire:
Enregistrer un commentaire