【发布时间】:2011-02-21 13:36:37
【问题描述】:
我正在尝试创建一个带有可编辑行的分组表视图(行数是固定的)。 我找到了this Apple example,尤其是静态行内容技术部分。我实现了它,但应用程序因此错误而崩溃
*** Assertion failure in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:], /SourceCache/UIKit_Sim/UIKit-1262.60.3/UITableView.m:5494
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
我在 Apple 文档中做了所有解释:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0) {
return cell0;
}
// section 1
if (indexPath.row == 0) {
return cell1;
}
return cell2;
}
cell0、cell1、cell2 是在 xib 中指定的单元格以及对应的 tableview。
出口和代表设置正确。
我知道很难找到错误,但欢迎提出任何建议。
【问题讨论】:
标签: iphone uitableview xib