NSSavePanel获取取消按钮对象

时间:2016-05-02 16:53:21

标签: cocoa

我想显示相对于"取消"我的NSSavePanel按钮,但这似乎不可能。这是一个示例代码,解释了我需要做的事情:

    // the save panel is called when the _window3 get closed..
[panel beginSheetModalForWindow:_window3 completionHandler:^(NSInteger result)
  {

      if (result == NSFileHandlingPanelOKButton)
      {

          // ok, saving my file! (also the app get closed)
      }
      else
      {
          /* (the app get closed w/o saving anything ATM)
           but... you are really sure????
           Since you have done a long job with this app you can also push the button by mistake.. (OMG)

           Nice should be to add a Popover relative to the cancel button rect, where the user can see and push
           on a "go back" and the "Exit w/o saving" buttons
           */

          // normally I call a popover this way:
          [_goBackOrExitPopover showRelativeToRect:[cancelBtn bounds] ofView:cancelBtn preferredEdge:NSMinYEdge];
           // ... but how to intercept the cancel button (cancelBtn)??
      }
  }];

如何找到取消按钮对象?

0 个答案:

没有答案
相关问题