我在使用 TableView 时遇到问题,在旧版 Xcode 中没有,我只是在 UITableView 中创建基本单元格,但出现下一个错误。
'NSInternalInconsistencyException',原因:'UITableView 数据源必须从 tableView 返回一个单元格:cellForRowAtIndexPath:'
这是.m中的代码
// numero de secciones a definir
>-(NSInteger) numberOfSectionsInTableView: (UITableView*) tableView
{
return 1;
}
>// numero de celdas en total
>-(NSInteger) tableView : (UITableView *) tableView numberOfRowsInSection: (NSInteger)section
{
return 5;
}
>// formato de las celdas, títulos, imágenes...
>-(UITableViewCell *)tableview : (UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath
{
static NSString *CellIdentifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[ UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
> // configure the cell...
return cell;
}
有什么建议吗?谢谢