0
我正在为学校开发一个应用程序,并且我希望在某个NSView区域中单击鼠标时更改光标图片。Xcode鼠标和NSView的基本帮助?
我知道你可以使用mousedown,mouseup和其他事件,但我真的不知道如何将它们放在我的代码中,以便光标图片更改工作。
我正在为学校开发一个应用程序,并且我希望在某个NSView区域中单击鼠标时更改光标图片。Xcode鼠标和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]];
}
太谢谢你了!对此,我真的非常感激 :) – Ant