在OSX应用程序中更改光标

Han*_*urg 0 macos cocoa

我正在尝试使用以下代码更改OS X应用程序中的光标(从Xcode文档复制):

NSCursor* c = [NSCursor pointingHandCursor]; [c set];
Run Code Online (Sandbox Code Playgroud)

它没有生效,我不确定我在这里做错了什么.任何想法都表示赞赏.

daf*_*afi 5

在NSView上你可以试试

- (void)resetCursorRects {
    [super resetCursorRects];
    [self addCursorRect:[self bounds] cursor:[NSCursor pointingHandCursor]];
}
Run Code Online (Sandbox Code Playgroud)

这应该也适用于NSWIndow,但我还没有测试过