I've got one NSMutableArray with 100+ characters in which I've populated a table with:
int rowCount = indexPath.row;
Character *character = [self.characterArray objectAtIndex:rowCount];
cell.textLabel.text = character.name;
cell.detailTextLabel.text = character._id;
I've then got a separate NSMutableArray with an _id and neighbour values in, however this array only has around 8 values with random id's in.
Basically I want to check if the character._id exists in the second array, It'll display a checkmark on the table.
I've tried doing:
Neighbour *neighbour = [self.neighbourArray objectAtIndex:rowCount];
if (character._id == neighbour._id && neighbour.neighbour == 1){
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}else{
cell.accessoryType = None;
}
But it crashes the App (because it only has 8 values of 100, I'm guessing)
Is there an easy way around this or a better way to check altogether?
Thanks, any constructive advise would be greatly appreciated, I'm brand new to Xcode.