Ios5 使用情节提要的自定义UITableViewCell

Ios5 使用情节提要的自定义UITableViewCell,ios5,uitableview,storyboard,Ios5,Uitableview,Storyboard,我正在尝试使用故事板制作自定义单元格。 我用基本单元测试了我的程序,它成功了。 现在我已经创建了一个名为NewsCell的新类,它在自定义单元格中包含不同的标签。 我还使该单元格成为NewsCell的一个子类。单元标识符为“NewsCell” 这是cellForRowAtIndexPath:方法: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPa

我正在尝试使用故事板制作自定义单元格。 我用基本单元测试了我的程序,它成功了。 现在我已经创建了一个名为NewsCell的新类,它在自定义单元格中包含不同的标签。 我还使该单元格成为NewsCell的一个子类。单元标识符为“NewsCell”

这是cellForRowAtIndexPath:方法:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NewsCell *cell = (NewsCell *)[tableView dequeueReusableCellWithIdentifier:@"NewsCell"]; //signal : SIGABRT
    News *info = [self.news objectAtIndex:indexPath.row];
    cell.titreLabel.text = info.titre;
    cell.descriptionLabel.text = info.description;
    return cell;
}
当我运行我的应用程序时,它会在第一次对齐时以信号SIGABRT崩溃。 我确信我在标签和表视图单元格之间建立了正确的连接

***由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因是:“NIB数据无效。”


您尚未为单元格创建实例。尝试为单元格创建实例

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    NewsCell *cell = (NewsCell *)[tableView dequeueReusableCellWithIdentifier:@"NewsCell"]; //signal : SIGABRT

     if (cell == nil) {
            cell = [[[NewsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        }
    News *info = [self.news objectAtIndex:indexPath.row];
    cell.titreLabel.text = info.titre;
    cell.descriptionLabel.text = info.description;
    return cell;
}

我也有同样的问题。事实证明,我已经在脚本文件的Interface Builder文档窗格中选中了“使用自动布局”。在iOS 5上运行时,这会抛出“无效NIB”错误,因为只有iOS 6支持自动布局。

它不起作用,我正在尝试创建一个自定义单元格,而不是基本单元格。
cell==nil
/create部分不再需要用于故事板(及其模板单元格)。