Hi all,
I believe that this challenge is much more difficult than it looks. As everybody here I wrote the code in the .m file as follows (it goes without say that the line in the .h file has been added as the work in the .xib).
[code]- (IBAction)removeTask:(id)sender;
{
if([self.taskTable selectedRow]<0){//selectedRow returns -1 if no row is selected.
return;
}
[self.tasks removeObjectAtIndex:[self.taskTable selectedRow]];
//The following is the same as in addTask
//now we have to tell the table-view to update and to tell DataSource (that here is an object of Document) to show the new data
[self.taskTable reloadData];
//now we tell the application (using updateChangeCount) that it has to mark the document us unsaved (with NSChangedone)
[self updateChangeCount:NSChangeDone];
}
[/code]
The pic below shows what happen to my app. I hope it is self-explaining (from 2 to 3 and 4 to 5 i click remove; from 6 to 7 and 7 to 8 I click on add). There are 8 windows in the pictures ordered and numbered in sequence (if you don’t see 8 of them then open the picture in a new window/panel).