I have a subclass of NSDocument in which I have implemented the writeToFile and readFromFile methods. The writeToFile method works fine using writeToFile:atomically: and even the readFromDocument works. I am writing and reading an NSDictionary. The problem comes with loadDocWithData. When I debug my app and open a file, all the components run fine, but no data is displayed in my new window.
- (void)loadDocWithData
NSMutableDictionary *)data {
Card *card;
NSString *keyword;
int i;
if (data) {
keywordList = [NSMutableArray arrayWithArray:[data allKeys]];
for (i = 0; i < [data count]; i++) {
keyword = [keywordList objectAtIndex:i];
NSLog(keyword);
NSLog([data objectForKey:keyword]);
card = [[[Card alloc] init] autorelease];
[card setWord:keyword];
[card setDefinition:[data objectForKey:keyword]];
[keywordDict setObject:card forKey:keyword];
}
[keywordTable reloadData];
[keywordTable selectRow:[keywordList indexOfObject:keyword] byExtendingSelection:NO];
}
}
The program works perfect when a new file is used, but when I try to open a saved file that I know has content, the new interface seems to be reset.
Any ideas on what the problem is???
Thanks,
Charlie
[ 02-05-2002: Message edited by: cmoad ]
[ 02-05-2002: Message edited by: cmoad ]