problem with NSArray in a NSTableView
problem with NSArray in a NSTableView
- Subject: problem with NSArray in a NSTableView
- From: Reuss <email@hidden>
- Date: Thu, 1 Nov 2001 15:27:48 +0100
Hello everybody,
I try to program a multi-document application, where the main data is
contained in a NSMutableArray containing identical NSDictionaries.
This array is defined in a modelObject controlled by a subclass of NSDocument.
The user can add, insert and delete dictionaries via the GUinterface,
where the NSMutableArray is shown in a NSTableView.
1) The first problem is that I can't get the NSTableView to show the
data unless defining directly an outlet from the windowController to
the modelObject and sending an [aTableView reloadData] method. But by
doing this the undo command won't work any more for the NSTextViews
of the GUinterface. Nevertheless I can't see the difference between
using an outlet diretly and addressing it by an access method (like
[[self document] myModel]).
2) Another problem is, that I tink I violate the MVC-Programming by
connecting the NSTableView's dataSource directly to the modelObject.
But how could I connect it by using the modelControler ?
3) Finally I would like to write this NSArray to the hard disk. But
NSMutableArray doesn't give any method to directly write the array to
the disk. Do I have to use an Archiving method, or could I write the
whole array into a one-element dictionary and use the
writeToFile:fileName atomically: method to write the array to the
disk ?
Sorry for asking so many questions, but i'm stuck on this for quite a
while and can't find any ideas in the documentation.
Thank you in advance
Tom