部分UICollectionViewDropDelegate方法没有被调用
创始人
2024-12-24 08:30:31
0

这个问题通常是由于忘记在 UICollectionViewCell 或 UICollectionView 上设置 dragInteractionEnabled 属性导致的。确保将该属性设置为 true,以启用拖放操作并正确调用委托方法。以下是一个示例代码,展示如何设置 dragInteractionEnabled 属性:

class MyCollectionViewCell: UICollectionViewCell {
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.dragInteractionEnabled = true
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.dragInteractionEnabled = true
    }
}

class MyCollectionView: UICollectionView {
    override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
        super.init(frame: frame, collectionViewLayout: layout)
        self.dragInteractionEnabled = true
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.dragInteractionEnabled = true
    }
}

将 dragInteractionEnabled 属性设置为 true 后,您应该能够正确地调用所有 UICollectionViewDropDelegate 方法。

相关内容

热门资讯

透视数据!竞技联盟辅助(透视)... 透视数据!竞技联盟辅助(透视)教你攻略(2021已更新)(哔哩哔哩)亲,关键说明,竞技联盟辅助赛季回...
辅助透视!aapoker公共底... 辅助透视!aapoker公共底牌(透视)辅助(好像存在有挂)1、让任何用户在无需aapoker公共底...
透视有挂!佛手在线大菠萝辅助(... 透视有挂!佛手在线大菠萝辅助(透视)科技教程(2026已更新)(哔哩哔哩);1、该软件可以轻松地帮助...
透视教程!aapoker怎么提... 透视教程!aapoker怎么提高中牌率(透视)透视脚本(切实有挂)1、玩家可以在aapoker怎么提...
透视黑科技!fishpoker... 透视黑科技!fishpoker透视底牌(透视)2025教程(2021已更新)(哔哩哔哩);1、构建自...
透视教程!红龙poker辅助平... 透视教程!红龙poker辅助平台(透视)详细教程(2025已更新)(哔哩哔哩);1、金币登录送、破产...
透视系统!aapoker透视脚... 透视系统!aapoker透视脚本入口(透视)插件(一直真的是有挂);1、操作简单,无需注册,只需要使...
透视辅助!epoker透视底牌... 透视辅助!epoker透视底牌(透视)可靠教程(2021已更新)(哔哩哔哩)透视辅助!epoker透...
透视游戏!aapoker辅助插... 透视游戏!aapoker辅助插件工具(透视)ai插件(本来真的有挂);1、aapoker辅助插件工具...
透视线上!xpoker辅助工具... 透视线上!xpoker辅助工具(透视)普及教程(2025已更新)(哔哩哔哩)一、xpoker辅助工具...