I want to create a landscape view with 2 table views side by side, using separate table controllers.
When I select a row, I want to move that selection to the other table. Initially I wanted an array, but I couldn't pass the array to the other controller. The array was a property of the table view controller.
I then tried to write the selection to core data, but that is crashing. To simplify, I have 2 entities in core data, Person (with name attribute and to one relationship) and SelectedPerson (with just the to one relationship to Person).
I have added the following:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Person *person = (Person *)[fetchedResultsController objectAtIndexPath:indexPath];
SelectedPerson *selectedPerson = [NSEntityDescription insertNewObjectForEntityForName:@"SelectedPerson"
inManagedObjectContext:managedObjectContext];
[selectedPerson setValue:person forKey:@"persons"];
[leftViewController.tableView reloadData];
NSLog(@"Selection saved OK");
If I temporarily delete my left controller from the nib, this works fine and when I add it back, it opens with the selected persons. But with the left table view, I get the following crash log:
[49650:207] Record saved OK
[49650:207]-[Person compare:]: unrecognized selector sent to instance
[49650:207] Serious application error. Exception was caught during Core Data change processing: -[Person compare:]: unrecognized selector sent to instance 0x3d33ef0 with userInfo (null)
***I have uploaded a sample application here link text
I've seen apps that use side by side tables, but I'm struggling to get this working. Any help would be greatly appreciated.