코어 데이터를 사용하고 UITableView
에 NSMutableSet
을 채우려고합니다. 나는 두 개의 엔티티, 팀 및 플레이어이 있습니다. 내가 그 팀의 선수들과의 tableview을 채우기 위해 노력하고 또 다른의 ViewController에NSMutableSet으로 TableView 채우기
-(void)saveButtonWasPressed {
self.team =[NSEntityDescription insertNewObjectForEntityForName:@"Team" inManagedObjectContext:self.managedObjectContext];
Player *newPlayer = (Player *)[NSEntityDescription insertNewObjectForEntityForName:@"Player"
inManagedObjectContext:self.managedObjectContext];
team.schoolName = _schoolName.text;
team.teamName = _teamName.text;
team.teamID = _teamName.text;
team.season = _season.text;
team.headCoach = _headCoach.text;
team.astCoach = _assistantCoach.text;
[self.team addPlayers:_tempSet];
[self.managedObjectContext save:nil];
[self.navigationController popViewControllerAnimated:YES];
}
를 다음과 같이 내 addTeamsController
에 나는 팀에 선수를 저장하고있다.
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"firstName" ascending:NO];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
_array = [[_team.players allObjects] sortedArrayUsingDescriptors:sortDescriptors];
다음 행과 인덱스 경로에 대한 내 세포에 나는 다음과 같은
cell.textLabel.text = [_array objectAtIndex:indexPath.row];
을하고있는 중이 야 다음에 내가 오류를
[Player isEqualToString:]: unrecognized selector sent to instance
I를 먹을수록 내가 뭐하는 거지 그렇게하려면 플레이어의 이름으로 정렬 된 tableview를 작성하는 가장 좋은 방법은 무엇인지 궁금합니다.