[英]Change cursor in OSX app
I'm trying to change the cursor in an OS X app with the following code (copied from Xcode docs): 我正在尝试使用以下代码(从Xcode文档复制)在OS X应用程序中更改光标:
NSCursor* c = [NSCursor pointingHandCursor]; [c set];
It is not taking effect and I'm not sure what I am doing wrong here. 它没有生效,我不确定在这里我做错了什么。 Any ideas are appreciated.
任何想法表示赞赏。
On an NSView you can try 在NSView上,您可以尝试
- (void)resetCursorRects {
[super resetCursorRects];
[self addCursorRect:[self bounds] cursor:[NSCursor pointingHandCursor]];
}
This should work also on NSWIndow but I have not not tested 这在NSWIndow上也应该工作,但我尚未测试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.