我的ViewController有三个UICollectionView,用于我创建的所有UICollectionView contextMenu,但是对于最后一个UICollectionView,我不想显示菜单,并且对于,所有的都工作得很好,但是对于这个长按的UICollectionview动画没有禁用。
如何禁用上一次UICollectionView的长冲压动画?这确实很简单,但我不能删除默认情况。
我的代码示例:
func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
switch collectionView {
case favoriteCollectionView:
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) {...}
case allCollectionView:
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) {...}
default:
// This menu empty and doesn't show but the animation of long pressed not disabled how to fix this?
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil)
}
}发布于 2021-02-24 20:34:02
传递return UIContextMenuConfiguration(identifier: nil, previewProvider: nil)的return nil实例
func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
switch collectionView {
case favoriteCollectionView:
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) {...}
case allCollectionView:
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) {...}
default:
return nil //<-- HERE
}
}https://stackoverflow.com/questions/66350899
复制相似问题