美文网首页
UICollectionView

UICollectionView

作者: 纳兰沫 | 来源:发表于2019-11-20 16:43 被阅读0次

对UICollectionView 进行一组动画 如果想连贯性的实现 使用collectionView.performBatchUpdates(<#T##updates: (() -> Void)?##(() -> Void)?##() -> Void#>, completion: <#T##((Bool) -> Void)?##((Bool) -> Void)?##(Bool) -> Void#>)方法 (先操作数据 再更新视图)

collectionView.allowsMultipleSelection = true
是否允许多选
menu
 override func collectionView(_ collectionView: UICollectionView, shouldShowMenuForItemAt indexPath: IndexPath) -> Bool {
        return true
    }

    override func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
        //只显示复制 黏贴
        if action == #selector(copy(_:)) || action == #selector(paste(_:)) {
            return true
        }
        return false
    }

    override func collectionView(_ collectionView: UICollectionView, performAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) {
    
        switch action {
        case #selector(copy(_:)):
            print("复制")
        case #selector(paste(_:)):
            print("黏贴")
        default:
            break
        }
    }

UICollectionViewDataSourcePrefetching 预加载

相关文章

网友评论

      本文标题:UICollectionView

      本文链接:https://www.haomeiwen.com/subject/yrjoictx.html