【发布时间】:2013-09-24 13:54:57
【问题描述】:
我在使用 TableView 时遇到问题,我在旧 Xcode 版本中没有,我只是在 UITableView 中创建基本单元格,但出现下一个错误。
'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from 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;
}
有什么建议吗?谢了
【问题讨论】:
标签: iphone uitableview xcode5