简体   繁体   中英

How do I clear a textfield when dragging and dropping?

I have an NSTextField in my app. I want to be able to drag text into the field from other apps. When this happens, I want my text field to erase anything that's already in it, and then show the text from the drag.

How do I do this? I can't figure out to know the text came from a drag. At the moment it just inserts the text whereever I drop it.

唯一的方法是对其进行子类化并处理所有nsview中包含的draggingXYZ方法

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM