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