ios - copyWithZone:]:发送到实例的无法识别的选择器

Ara*_*him 3 ios uicollectionview

我想创建一个单元格对象的副本.以下是我的代码,但检索copyWithZone:]:发送到实例的无法识别的选择器

  CollectionCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"KCell" forIndexPath:indexPath];

        if(kCell == nil)
        {


            cell = [self getiPadCell:indexPath cv:cv dict:dict];
            kCell = cell;
            return cell;
        }
        else
        {
            cell = [kCell copy];
            return cell;
        }
Run Code Online (Sandbox Code Playgroud)

And*_*kha 7

你的CollectionCell班级应该提供copyWithZone:方法的实现.它也应该符合NSCopying协议.想想你如何复制你的单元格并提供适当的实现.此链接可以帮助您更好地理解它