Determine which button pressed in Save Panel in NSDocument based application
How should I determine which button is pressed (save, C开发者_如何学运维ancel) 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?
精彩评论