Challenge


#1

So I figured out the challenge without issue, but what I didn’t add was a call to reloadData or the other variation presented in the solution. When I run my version (OS X 10.8.2), the table reloads the data without issue. Is this a change between the OS X versions or something else?


#2

This happens for me as well (also 10.8.2/4.5.2). No tableView reload of any kind, and everything displays and updates properly. Maybe the controller objects are getting smarter! Or maybe there is something hiding away waiting to bite us in the behind.

Also, after I finished the part of this that fast enumerates through the array of victims, I was dreading finding a one line alternative in the provided solution. I was quite pleased to see such similar code.

- (void)alertEnded:(NSAlert *)alert code:(NSInteger)choice context:(void *)v { NSLog(@"Alert sheet ended"); // If the user chose Remove, tell the array controller to // delete the people if (choice == NSAlertDefaultReturn) { // The argument to remove: is ignored // The array controller will delete the selected objects NSLog(@"DEFAULT RETURN"); [employeeController remove:nil]; // If the user chose Keep, reset the raises to 0.0 } else if (choice == NSAlertOtherReturn) { NSLog(@"OTHER RETURN"); for (Person *noRaiseDude in [employeeController selectedObjects]) { [noRaiseDude setExpectedRaise:0.0]; } // If the user chose Cancel, don't do anything } else if (choice == NSAlertAlternateReturn) { NSLog(@"ALTERNATE RETURN"); // Twilight zone } else { NSLog(@"WTF?"); } }


#3

I guess it’s because of the binding.