<原>自定义cell的时候出现的错误(用的nib而不是storyboard)

自定义的步骤比较简单  

最后到了写代码 引用自定义的cell的时候

static NSString *CellIdentifier = @"DownloadCell";
    static BOOL nibsRegistered = NO;
    if (!nibsRegistered) {
        UINib *nib = [UINib nibWithNibName:@"DownloadTableCell" bundle:nil];
        [tableView registerNib:nib forCellReuseIdentifier:CellIdentifier];
        nibsRegistered = YES;
    }
    
    DownloadCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

  进行到最后一句的时候  就会出错

错误信息:

invalid nib registered for identifier ((null)) - nib must contain exactly one top level object which must be a UITableViewCell instance


大致意思就是  这个nib的注册不合法,   这个nib必须只保含一个 object  并且是UITableViewCell 的实例

来到自己创建的xib文件中

发现  这里有多个object  错误就出现在这,  把多余的object 删除 或者 加入到downloadcell 中后  问题 解决

原文地址:https://www.cnblogs.com/bucengyongyou/p/2712503.html