我的数组在每个索引处包含 (firstName,lastName, age)。现在我想在索引 1 处更改一个人的年龄。请指导如何做。这是我的代码。
- (void)viewDidLoad {
[super viewDidLoad];
productArray=[[NSMutableArray alloc]init];
PersonDetail *personObj = [[PersonDetail alloc] init];
personObj.firstName = @"Adeem";
personObj.lastName = @"Basraa";
personObj.age = @"5";
[productArray addObject:personObj];
[personObj release];
PersonDetail *personObj = [[PersonDetail alloc] init];
personObj.firstName = @"Ijaz";
personObj.lastName = @"Ahmed";
personObj.age = @"10";
[productArray addObject:personObj];
[personObj release];
PersonDetail *personObj = [[PersonDetail alloc] init];
personObj.firstName = @"Waqas";
personObj.lastName = @"Ahmad";
personObj.age = @"15";
[productArray addObject:personObj];
[personObj release];
}