NSToolbarItem screen layout

How can I get the on-screen location of a toolbar button? It turns out the rectangle of the rectangle NSToolbarItem? It seems that the method [NSToolbarItem view]always returns nilwhen the toolbar item is a simple action button, and therefore I could not use the usual methods NSViewto pinpoint the position of the toolbar on the screen.

Background

I am trying to use the Matt Gemmell component MAAttachedWindowto point to a specific toolbar button. The component requires that the object NSPoint"point" the user to a location on the screen.

Thanks in advance.

+3
source share
1

. , , , ... ToolbarItem - . :

- (IBAction)showOverlay:(id)sender {
    NSPoint clickedPoint = [self.window mouseLocationOutsideOfEventStream];
    self.overlayController = [[MyOverlayController alloc] initAtPoint:clickedPoint];
}
+1

Source: https://habr.com/ru/post/1739817/


All Articles