【发布时间】:2011-04-30 02:49:54
【问题描述】:
我正在一个可可应用程序中实现拖放,我正在使用 NSDraggingSource 协议中的以下方法:
- (void)draggedImage:(NSImage *)draggedImage movedTo:(NSPoint)screenPoint{
NSPoint 在屏幕坐标中给出,我需要它在窗口或视图坐标中。如果使用 NSEvent 调用该方法,我可以执行以下操作:
-(void)mouseDown:(NSEvent *)pTheEvent {
NSPoint tvarMouseInWindow = [pTheEvent locationInWindow];
NSPoint tvarMouseInView = [self convertPoint:tvarMouseInWindow fromView:nil]; }
但我无法弄清楚如何仅使用 NSPoint 来完成。提前致谢!
【问题讨论】:
标签: cocoa drag-and-drop