如何在可可中实现拖放功能?
假设我有一个可可应用程序,只有一个窗口,里面什么也没有。但是,如果用户将文件拖放到此窗口中,该文件将自动复制到特定目录。如何实现这样的拖放功能?
Suppose I have a cocoa application with just a window and nothing in it. But if the user drags and drops a file into this window, the file will automatically be copied to a particular directory. How do I implement such a drag-and-drop functionality?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
花费三秒钟搜索“cocoa Drag and Drop”会产生 Cocoa 拖放编程主题。您需要“拖动目标”部分(因为您正在响应拖到窗口的文件。请阅读文档并尝试按照说明进行操作。如果您遇到困难,请使用代码发布特定问题你使用过的以及你遇到的问题。
Three seconds invested in searching "cocoa drag and drop" produces the Drag and Drop Programming Topics for Cocoa. You want the "Dragging Destinations" section (since you're responding to a file dragged to your window. Read the documentation and try to follow along. If you get stuck, post a specific question with the code you used and the problem you encountered.