如何在Objective-C中更改鼠标光标 [英] How to change the mouse cursor in Objective-C
本文介绍了如何在Objective-C中更改鼠标光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个图像编辑应用程序,但它看起来很不完整,没有一个光标像他们在Photoshop的画笔。
I am making an image editing application, but it looks very incomplete without a cursor like they have in Photoshop for the paintbrush. How can I set the icon, and have it change back when I exit the application?
这是我的头文件中的代码(以防万一需要):
This is the code in my header file (just in case it's needed):
@interface test : NSWindow <NSWindowDelegate> {
IBOutlet id myView;
}
@end
myView
推荐答案
有一个可以显示所有内容的 NSView
方便的 NSCursor
类来处理游标外观。如果其中一个内置游标没有看到你需要它,你可以用 NSImage $ c>初始化一个新的
NSCursor
$ c>和 -set
为活动光标。
There's a handy NSCursor
class for handling cursor appearance. If one of the built-in cursors doesn't look how you need it to, you can initialize a new NSCursor
with an NSImage
and -set
it to be the active cursor.
这篇关于如何在Objective-C中更改鼠标光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文