10 명의 자녀 (개체)가 있고 각 어린이가 다른 학교 (배열)로 이동하면 다른 셔츠가 다릅니다 (개체의 값). 셔츠 색상을 기반으로 특정 아동을 찾는 가장 좋은 방법은 무엇입니까?많은 다른 배열에서 특정 개체를 찾습니다.
지금, 나는 긴 조금 보인다, 이렇게 :
Match *match;
match.match_id = @"The match id i want to find":
//Check array 1 for the object
for (Match *tempMatch in matchesGrouped)
{
if (tempMatch.match_id == match.match_id)
{
match = tempMatch;
matchFound = YES;
break;
}
}
//Check array 2 for the object
for (Match *tempMatch in matchesSingle)
{
if (tempMatch.match_id == match.match_id)
{
match = tempMatch;
matchFound = YES;
break;
}
}
etc for the rest of the arrays...
match_id 각 경기에 대한 고유 한 정수입니다. 사전에
덕분에
는 편집 : 경기는 다음과 같습니다
:
@interface Match : UIViewController <NSCoding>
{
}
//Match
@property (nonatomic) int match_id;
@property (nonatomic) int matchStatus;
@property (nonatomic) int numberOfPlayers;
etc...
배열에 10 명의 자녀가 있습니까? 셔츠 나 셔츠 색깔이 아이들 물건의 속성입니까? 자녀 개체의 코드를 보는 것이 도움이 될 것입니다. – rdelmar