Why am I getting an error about being unable to dequeue when my UITableView tries to load?

前端 未结 4 1631
抹茶落季
抹茶落季 2020-12-30 04:27

I get the following error:

* Terminating app due to uncaught exception \'NSInternalInconsistencyException\', reason: \'unable to dequeue a ce

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-30 05:13

    You're using the dequeueReusableCellWithIdentifier:forIndexPath: method. The documentation for that method says this:

    You must register a class or nib file using the registerNib:forCellReuseIdentifier: or registerClass:forCellReuseIdentifier: method before calling this method.
    

    So here

    [self.tableView registerClass: [FontCell class] forReuseIdentifier: @"FontCell"];
    

提交回复
热议问题