繁体   English   中英

在情节提要中自定义表视图单元时出现NSInternalInconsistencyException

[英]NSInternalInconsistencyException when customize tableview cell in storyboard

我想使用情节提要创建自定义UITableViewCell ,然后在运行程序时崩溃,这是日志:

***由于未捕获的异常“ NSInternalInconsistencyException”而终止应用程序,原因:“ UITableView(;动画= {position =;}; layer =; contentOffset:{0,0}; contentSize:{375,304.23076923076923}>)无法获取其dataSource()中的单元格”

我只是使用其标识符获取tableviewcell:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ThemeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"themecell"];

    return cell;
}

这是我的情节提要中的一些限制:

约束

1)确保使用正确的tableviewcell标识符。 2)然后,执行以下操作:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ThemeCell *cell = (ThemeCell *)[tableView dequeueReusableCellWithIdentifier:@"themecell"];
    return cell;
}

如果您使用的是Storyboard ,请确保在此选项卡中设置UITableViewCell标识符

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM