call to numberOfRowsInTableView during initialization
call to numberOfRowsInTableView during initialization
- Subject: call to numberOfRowsInTableView during initialization
- From: email@hidden
- Date: Mon, 12 Jun 2006 19:28:26 +0200 (CEST)
- Importance: Normal
Hello all,
I have a project that builds without error or warnings and runs fine,
but there's still one detail disturbing me : in some parts of my code
I put some ``watchdog" NSLog's and at runtime some of them appear (and they
shouldn't).
Here are the relevant parts in my code :
In MyDocument.h :
...
@interface MyDocument: NSDocument {
IBOutlet NSTableView *table1;
IBOutlet NSTableView *table2;
IBOutlet NSTableView *table3;
...
In MyDocument.m :
...
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
if (aTableView==table1) {
return ...
}
if (aTableView==table2) {
return ...
}
if (aTableView==table3) {
return ...
}
// should be unreachable, because there are no other table views
NSLog(@"This is a bug. Fix it ");
return 2006;
}
...
At runtime, the error message above is displayed in the console (three
times,
I guess this is because there are three table views). The debugger
shows that this occurs during the initialization phase, when the pointers
table1,table2 and table3 are still nil (that is, uninitialized) and the
argument aTableView is not nil.
It looks as though I should have initialized the pointers
table1,table2,table3
myself somewhere in the code. But once the correct connections are made in
the NIB file, there is nothing more to be done, right ?
Ewan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden