问题描述
我正在尝试使用故事板制作自定义单元格。
我用Basic单元测试了我的程序并且它有效。
现在我已经创建了一个名为NewsCell的新类,它包含自定义单元格中的不同标签。
我还将单元格作为NewsCell的子类。单元格标识符为NewsCell。
I'm trying to make a custom cell using storyboard.I have tested my program with Basic cells and it worked.Now I'have created a new class that I named NewsCell, which is containing the different Labels in the custom cell.I have also made the cell a subclass of NewsCell. The cell identifier is "NewsCell".
这是cellForRowAtIndexPath:方法:
This is the cellForRowAtIndexPath: method:
- (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 LIGNE。
我确定我在标签和表格视图单元格之间建立了正确的连接。
When I run my app, it crashes with a signal signal SIGABRT at the first ligne.I'm sure that I've made the right connections between Labels and the table view cell.
推荐答案
I had the same problem. It turned out that I had checked "Use Autolayout" in the Interface Builder Document pane of the Storyboard file. This throws the "invalid NIB" error when running on iOS 5 because autolayout is only supported on iOS 6.
这篇关于使用Storyboard自定义UITableViewCell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!