[英]Cocoa OSX set cursor during drag operation
When i set the cursor using 当我使用光标设置时
- (void)draggingSession:(NSDraggingSession *)session willBeginAtPoint:(NSPoint)screenPoint {
[[NSCursor closedHandCursor] set];
}
than very soon after it switches back to the default cursor 比它很快切换回默认光标后
During drag the cursor rects seems disables 在拖动过程中,光标似乎禁用
How to set the cursor during drag & drop operation? 如何在拖放操作期间设置光标?
As well as using set
to change the cursor, you can also use the NSCursor
methods push
and pop
- these don't rely on cursor rects. 除了使用set
更改光标外,还可以使用NSCursor
方法push
和pop
- 这些方法不依赖于光标。 You simply push
when you need to set a new cursor, and pop
when you want to get back to the cursor being used just before your push
call. 您只需在需要设置新光标时push
,然后在想要返回到push
调用之前使用的光标时pop
。 In your example, try using push
when the drag begins, and pop
in the delegate method that informs you when the drag is ended. 在您的示例中,尝试在拖动开始时使用push
,并在委托方法中pop
,该方法会在拖动结束时通知您。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.