如何为teamFullNames属性迭代数组allInfo?
NSMutableArray *allInfo = [[NSMutableArray alloc]init];
for(int i = 0; i < 14; i++) {
ExtraTeamInfoObject *temp = [[ExtraTeamInfoObject alloc] init];
temp.teamFullNames = _teamFullNames[i];
temp.teamStadiumNames = _teamStadiumNames[i];
temp.stadiumCapacity = _stadiumCapacity[i];
temp.clubFoundationDate = _clubFoundationDate[i];
temp.stadiumBuiltYear = _stadiumBuiltYear[i];
temp.teamCity = _teamCity[i];
temp.clubPresident = _clubPresident[i];
temp.headCoach = _headCoach[i];
temp.championshipsWon = _championshipsWon[i];
temp.domesticCupsWon = _domesticCupsWon[i];
temp.domesticLeagueCupsWon = _domesticLeagueCupsWon[i];
temp.domesticSuperCupsWon = _domesticSuperCupsWon[i];
temp.championsleaguesWon = _championshipsWon[i];
temp.europaleaguesWon = _europaleaguesWon[i];
temp.europeanSuperCupsWon = _europeanSuperCupsWon[i];
temp.worldclubchampionshipsWon = _worldclubchampionshipsWon[i];
[allInfo addObject:temp];
}
for (int i = 0; i < 14; i++) {
NSLog(@"Show me the goods %@", allInfo[i].teamFullNames); // its not working at all
}
}
任何人都可以帮助我迭代这个数组吗?我尝试了很多组合但没有成功..
干杯。
答案 0 :(得分:0)
NSLog(@"Show me the goods");
for (ExtraTeamInfoObject *obj in allInfo) {
NSLog(@"%@",obj.teamFullNames);
}
答案 1 :(得分:0)
您可以使用valueForKey通过键值编码执行此操作。这将为您提供所有名称的数组。
NSLog(@"Show me the goods %@", [allInfo valueForKey:@"teamFullNames"]);