gpt4 book ai didi

objective-c - 如果 subview 拒绝,则将 super View 作为拖动目标

转载 作者:太空狗 更新时间:2023-10-30 03:51:19 25 4
gpt4 key购买 nike

考虑一个 View (parent)和一个 subview (child)。两者都注册了拖动类型NSFilenamesPboardType

parent 只对图像文件感兴趣,child 对音频文件感兴趣。如果它们在 draggingEntered: 中检测到相应类型的文件,它们将返回 NSDragOperationCopy。如果不是,他们返回 NSDragOperationNone

childparent 重叠,当拖动到达 child 时,parent 收到一个 draggingExited: 消息,无论 child 是否对拖动感兴趣。

如果 child 不想要,我如何让 parent 接收到拖动?

最佳答案

如果我做对了,你应该调用:

[self.superview yourmethod];

在子函数中。

如果 child 继承自 parent ,您可以调用:

[super yourmethod];

关于objective-c - 如果 subview 拒绝,则将 super View 作为拖动目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10970398/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com