Thanks to help from StefanK I am now able to save my table view contents to a .plist file.
Is there a straightforward way of Loading them back in again?
B
Thanks to help from StefanK I am now able to save my table view contents to a .plist file.
Is there a straightforward way of Loading them back in again?
B
Yes,
NSArray and NSDictionary have methods to read a plist file from disk
arrayWithContentsOfFile: and dictionaryWithContentsOfFile:
Thanks Stefan
How would I go about clearing the existing contents of the Table View?
B
the array controller has methods to add and remove objects, for example
arrayController's removeObjects:(arrayController's arrangedObjects())
I am getting this error when I try loading a .plist to the table view
2014-03-14 19:41:20.960 SMPTE Grabber[15174:303] -[NSArrayController arrayWithContentsOfFile:]: unrecognized selector sent to instance 0x6080001c2ee0
2014-03-14 19:41:20.963 SMPTE Grabber[15174:303] *** -[AppDelegate ChooseOpen:]: -[NSArrayController arrayWithContentsOfFile:]: unrecognized selector sent to instance 0x6080001c2ee0 (error -10000)
the sender is
on ChooseOpen:sender
set resultFile to choose file with prompt "Select Saved File"
set OpenThis to POSIX path of resultFile
ArrayController's arrayWithContentsOfFile:OpenThis
end ChooseOpen:
arrayWithContentsOfFile: belongs to NSArray, not to NSArrayController
set resultFile to choose file with prompt "Select Saved File"
set theArray to current application's NSArray's arrayWithContentsOfFile:(POSIX path of resultFile)
arrayController's addObjects:theArray
It doesn’t appear to do anything, do I need to link th NSArray to the table view or Array Controller in the IB?
B
the snippet assumes that arrayController is connected to an NSArrayController instance in IB
I have arrayContoller set as a referencing outlet to my Array Controller, is this what you mean?
B
Yes, and the value of the table columns must be bound to the appropriate dictionary keys