Xcode鼠标和NSView基本帮助?

Xcode鼠标和NSView基本帮助?,xcode,click,mouse,nsview,Xcode,Click,Mouse,Nsview,我正在为学校制作一个应用程序,当鼠标点击某个NSView区域时,我想更改光标图片 我知道您可以使用mousedown、mouseup和其他事件,但我真的不知道如何将它们放入我的代码中,以使光标图片更改生效。具有自定义NSView并覆盖resetCursorRect, 请参阅下面的示例代码 -(void)resetCursorRects{ //[self log:@"Inside Reset Cursor Rect"]; NSRect viewRect = [self frame

我正在为学校制作一个应用程序,当鼠标点击某个NSView区域时,我想更改光标图片


我知道您可以使用mousedown、mouseup和其他事件,但我真的不知道如何将它们放入我的代码中,以使光标图片更改生效。

具有自定义NSView并覆盖resetCursorRect, 请参阅下面的示例代码

-(void)resetCursorRects{

    //[self log:@"Inside Reset Cursor Rect"];
    NSRect viewRect = [self frame];// change it accordingly 
    [self addCursorRect:viewRect cursor:[NSCursor pointingHandCursor]];

    viewRect = [self.pMailImageView frame];
    [self addCursorRect:viewRect cursor:[NSCursor pointingHandCursor]];

    viewRect = [self.pDialImageView frame];
    [self addCursorRect:viewRect cursor:[NSCursor pointingHandCursor]];



}

非常感谢你!我真的很感激:)