How should I determine which button is pressed (save, Cancel) when the save dialog is dismissed in an NSDocument based application ? The save panel is the default provided by NSDocument when save is selected from menu.

I would like to have the chance to change some vars before - (BOOL)writeToURL:ofType:error: is invoked.

Thanks...

有帮助吗?

解决方案

You could set an object as the save panel's delegate and implement the ‑panel:validateURL:error: method. That method is called after the Save button is pressed but before the document is saved.

However, I'd question the need to do this. What sort of variables do you need to change only when the file is saved? What are you trying to accomplish?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top