0
我有NSWindow與自定義NSView。此自定義NSView覆蓋performDragOperation方法。拖放操作很好。但是當我創建並顯示NSAlert作爲模式窗口時,我需要阻止拖放操作,不應調用performDragOperation。如何在NSAlert顯示爲模式窗口時禁用所有拖放操作
NSAlert *alert = [[NSAlert alloc]init];
[alert addButtonWithTitle:@"Excellent"];
[alert setMessageText:@"This is your message."];
[alert runModal];
可能的解決方案之一是添加代碼,驗證是否顯示對話框執行DragOperation方法。但是如何檢測是否顯示NSAlert。 例如,對於片我可以使用:
if([window attachedSheet]) {
...
}
但如何爲
[alert runModal];
'NSApplication'有一個屬性'modalWindow'。 – Willeke
謝謝Willeke。這正是我需要的。 –