Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ユーザーがステータスバーの NSStatusItem をクリックすると開く NSMenu があります。NSMenu が開いている (展開されている) かどうかを確認するにはどうすればよいですか?
ありがとうございました!
NSMenuDelegateプロトコルを使用してmenuWillOpenメッセージを処理menuWillCloseできます。menuWillOpenメニューが開いていることを示すブール値を設定し、menuWillCloseそれをオフにするために使用します。
NSMenuDelegate
menuWillOpen
menuWillClose
更新:menuWillClose:は、使用可能なデリゲート メソッドではなくなったようです。menuDidClose:代わりに使用してください。
menuWillClose:
menuDidClose: