"Controller cannot be nil" message when loading from file
"Controller cannot be nil" message when loading from file
- Subject: "Controller cannot be nil" message when loading from file
- From: Tom Jones <email@hidden>
- Date: Tue, 13 Dec 2005 09:06:02 -0600
I have a document-based project that uses bindings, and
programatically binds the columns of an NSTableView. There are two
ways this code gets called. One is when the user imports a playlist
from iTunes into the application, this always works. The other is when
the user opens a saved document created by my application, this never
works. The code comes from a call to MyDocument's setPlaylist method.
for (i = 0; i< [[playlist columns] count]; i++)
{
NSTableColumn *newColumn;
newColumn = [[[NSTableColumn
alloc]initWithIdentifier:[[playlist columns] objectAtIndex:i]]
autorelease];
[[newColumn headerCell] setStringValue:[[playlist columns]
objectAtIndex:i]];
[theTableView addTableColumn:newColumn];
NSString *keypathPrefix =@"arrangedObjects.properties.";
NSMutableString *theKeypath = [[keypathPrefix
stringByAppendingString:[[playlist columns] objectAtIndex:i]]
mutableCopy];
[newColumn bind:@"value"
toObject:playlistItemsController withKeyPath:theKeypath options:nil];
}
my solution was to move this code to a separate method in MyDocument,
playlistChanged, and to call playlistChanged from
windowControllerDidLoadNib. is this the correct way to handle
programatic bindings in Document-based applications?
_______________________________________________
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