<bdo id='okdHA'></bdo><ul id='okdHA'></ul>
      <legend id='okdHA'><style id='okdHA'><dir id='okdHA'><q id='okdHA'></q></dir></style></legend>

      <tfoot id='okdHA'></tfoot>
    1. <small id='okdHA'></small><noframes id='okdHA'>

      1. <i id='okdHA'><tr id='okdHA'><dt id='okdHA'><q id='okdHA'><span id='okdHA'><b id='okdHA'><form id='okdHA'><ins id='okdHA'></ins><ul id='okdHA'></ul><sub id='okdHA'></sub></form><legend id='okdHA'></legend><bdo id='okdHA'><pre id='okdHA'><center id='okdHA'></center></pre></bdo></b><th id='okdHA'></th></span></q></dt></tr></i><div id='okdHA'><tfoot id='okdHA'></tfoot><dl id='okdHA'><fieldset id='okdHA'></fieldset></dl></div>

        单击外部时隐藏 MAAttachedWindow

        时间:2023-08-31
        <legend id='CShZj'><style id='CShZj'><dir id='CShZj'><q id='CShZj'></q></dir></style></legend>

      2. <tfoot id='CShZj'></tfoot>

          <i id='CShZj'><tr id='CShZj'><dt id='CShZj'><q id='CShZj'><span id='CShZj'><b id='CShZj'><form id='CShZj'><ins id='CShZj'></ins><ul id='CShZj'></ul><sub id='CShZj'></sub></form><legend id='CShZj'></legend><bdo id='CShZj'><pre id='CShZj'><center id='CShZj'></center></pre></bdo></b><th id='CShZj'></th></span></q></dt></tr></i><div id='CShZj'><tfoot id='CShZj'></tfoot><dl id='CShZj'><fieldset id='CShZj'></fieldset></dl></div>

            • <bdo id='CShZj'></bdo><ul id='CShZj'></ul>

                <small id='CShZj'></small><noframes id='CShZj'>

                  <tbody id='CShZj'></tbody>

                  本文介绍了单击外部时隐藏 MAAttachedWindow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用 MAAttachedWindow 在下显示自定义窗口菜单栏中的 NSStatusItem.一切正常,但是当用户在窗口外单击时,我找不到一种简单的方法来隐藏它.我想实现这种行为,因为它是用户所期望的.

                  I'm using an MAAttachedWindow to display a custom window under a NSStatusItem in the Menubar. Everything works fine, but I can't find an easy way to hide it when the user clicks outside of the window. I want to implement this behavior because it's what the user expects.

                  这是用于显示MAAttachedWindow的代码:

                  - (void)toggleAttachedWindowAtPoint:(NSPoint)pt {
                      if (!self.attachedWindow) {  
                          self.attachedWindow = [[MAAttachedWindow alloc] initWithView:logView
                                attachedToPoint:pt 
                                 inWindow:nil 
                                   onSide:MAPositionBottom 
                                  atDistance:5.0];
                  
                    [self.attachedWindow setLevel:kCGMaximumWindowLevel];
                   }
                  
                   if(isVisible)
                    [self.attachedWindow makeKeyAndOrderFront:self];
                   else
                    [self.attachedWindow orderOut];
                  }
                  

                  此代码由带有自定义视图的 NSStatusItem 触发,该视图拦截对其的点击.

                  This code gets triggered by an NSStatusItem with a custom view which intercepts a click on it.

                  推荐答案

                  你应该可以通过窗口的委托方法做到这一点:

                  You should be able to do this via the window's delegate method:

                  - (void)windowDidResignKey:(NSNotification *)notification

                  将自己设置为窗口的委托,并实现它以调用您的切换方法.

                  Set yourself as the window's delegate, and implement that to call through to your toggle method.

                  这篇关于单击外部时隐藏 MAAttachedWindow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:onTouch,onLongClick一起在android中 下一篇:MapView 中的 OnTouch 仅在第一次触发

                  相关文章

                  最新文章

                  1. <legend id='KKh9a'><style id='KKh9a'><dir id='KKh9a'><q id='KKh9a'></q></dir></style></legend>

                      <i id='KKh9a'><tr id='KKh9a'><dt id='KKh9a'><q id='KKh9a'><span id='KKh9a'><b id='KKh9a'><form id='KKh9a'><ins id='KKh9a'></ins><ul id='KKh9a'></ul><sub id='KKh9a'></sub></form><legend id='KKh9a'></legend><bdo id='KKh9a'><pre id='KKh9a'><center id='KKh9a'></center></pre></bdo></b><th id='KKh9a'></th></span></q></dt></tr></i><div id='KKh9a'><tfoot id='KKh9a'></tfoot><dl id='KKh9a'><fieldset id='KKh9a'></fieldset></dl></div>

                      • <bdo id='KKh9a'></bdo><ul id='KKh9a'></ul>
                      <tfoot id='KKh9a'></tfoot>

                    1. <small id='KKh9a'></small><noframes id='KKh9a'>