Question

The Mac OS X Human Interface Guidelines says in their section about windows:

Note that if a user opens, moves, and closes a document window without making any other changes, you should save the new window position but you should not modify the file’s date stamp.

How are we supposed to do this? If I have a document-based application and I want to save documents’ windows’ positions and sizes in their files—without touching their date stamps—I override dataOfType:error, etc. But, as far as I can tell, all of these automatically modify the file’s date stamp.

There’s only one way I see to do this, and it’s kind of a hack: use NSFileManager to temporarily save the file’s old date stamp, save the window’s position in the file, and then use setAttributes:ofItemAtPath:error to change it back.

Is there a better way? Surely if it’s a common task...

Was it helpful?

Solution

How about saving the window's position in NSUserDefaults instead of the document?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top