Mouse Down events in Objective-C

前端 未结 3 1486
情书的邮戳
情书的邮戳 2021-01-20 12:10

I know this question has been asked a lot before, but nothing will work for me. The following code will not do anything at all.

- (void) mouseDown:(NSEvent*)         


        
3条回答
  •  半阙折子戏
    2021-01-20 12:33

    You're overriding the NSWindow class, you should be overriding the NSView "contentView" of the NSWindow class to capture mouse events. Most of the decorations (NSViews) on the window outside of the contentView are private.

    Just create a new NSView that overrides mouseDown, etc and add it as your content view to the NSWindow object.

提交回复
热议问题