PDA

View Full Version : My tableView method will not fire - Hillegass Chapter 28




John Baughman
Aug 31, 2009, 10:02 PM
I have checked and rechecked things but I cannot get tableView.objectValueForTableColumn:row to fire.

numberOfRowsInTableView is the only table view method getting called when I call [tableView reloadData].

I have set the App Controller as the data source for the Table View and App Controller tableView outlet is set to the Table View. What am I missing.

John



scootaru
Aug 31, 2009, 11:39 PM
If it's not being called at all, the method probably isn't spelled exactly as it should be in the implementation file. Post your objectValueForTableColumn method.

John Baughman
Sep 1, 2009, 02:17 AM
If it's not being called at all, the method probably isn't spelled exactly as it should be in the implementation file. Post your objectValueForTableColumn method.


- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)row
{


}

scootaru
Sep 1, 2009, 04:56 AM
As you already know, that is the correct method. You didn't mention it, but did you also link the delegate of tableView to the AppController object?

John Baughman
Sep 1, 2009, 02:34 PM
As you already know, that is the correct method. You didn't mention it, but did you also link the delegate of tableView to the AppController object?

No, but I tried to do that now and it still does not work. To link the delegate I right clicked the Table View and dragged from the Outlet Delegate line to the App Controller... Right?

In the sample code for the book Hillegass did not link the delegate. I can't test the sample as it is not complete in that it does not contain the code for creating a required Amazon.com web services request.

I think what I am going to do unless someone helps me out, is add the necessary code to the sample project and see if tableView method works there.

John

mdeh
Sep 1, 2009, 04:58 PM
No, but I tried to do that now and it still does not work. To link the delegate I right clicked the Table View and dragged from the Outlet Delegate line to the App Controller... Right?

In the sample code for the book Hillegass did not link the delegate. I can't test the sample as it is not complete in that it does not contain the code for creating a required Amazon.com web services request.

I think what I am going to do unless someone helps me out, is add the necessary code to the sample project and see if tableView method works there.

John

Try and clean the project, then compile and run.

John Baughman
Sep 1, 2009, 06:46 PM
Try and clean the project, then compile and run.

Still no luck. :confused:

John Baughman
Sep 2, 2009, 04:12 AM
I found the problem, but don't understand why it breaks the call to the tableView method especially since numberOfRowsInTableView does get called.

In this app we have the following code..


[itemNodes release];
itemNodes = [[doc nodesForXPath:@"ItemSearchResponse/Items/Item" error:&error] retain];
if (!itemNodes) {
NSAlert *alert = [NSAlert alertWithError:error];
[alert runModal];
return;
}

// Update the interface
[tableView reloadData];
[progress stopAnimation:nil];



My mistake was instead of having @"ItemSearchResponse/Items/Item" I had @"ItemsSearchResponse/Items/Item". Note the extra s in @"ItemSearch...". Even with the typo, it does not fall into alert for (!itemNodes). So why does reloadData call numberOfRowsInTableView but not the tableView method.

Thanks for all who tried to help. I think I am good to continue on.

John