Ios 如何使用nib文件为表视图创建动态单元格

Ios 如何使用nib文件为表视图创建动态单元格,ios,objective-c,iphone,uitableview,core-data,Ios,Objective C,Iphone,Uitableview,Core Data,我正在学习如何使用笔尖,以及一般的新手 我有一个表视图和另一个视图,我在其中创建对象来填充这个表视图。我也在使用核心数据 我的表视图未填充…这是我的cellForRowAtIndexPath: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"Cell";

我正在学习如何使用笔尖,以及一般的新手

我有一个表视图和另一个视图,我在其中创建对象来填充这个表视图。我也在使用核心数据

我的表视图未填充…这是我的cellForRowAtIndexPath:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *cellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];

    Target *target = [self.fetchedResultController objectAtIndexPath:indexPath];

    cell.textLabel.font = [UIFont fontWithName:@"Candara-Bold" size:20];

    cell.textLabel.text = target.body;

    // Configure the cell...

    return cell;
}
这是我的笔尖:


我很想在这里得到帮助…谢谢

您可以使用自动布局,我认为这是最简单的方法

使用nib时,必须注册nib

示例:
tableView.registerNib(UINib(nibName:StoreCell,bundle:nil),forCellReuseIdentifier:StoreCell)

并且必须将UILabel行数设置为0


此测试项目适合您

您的代码看起来不错,但没有足够的信息进行故障排除。您是否执行了第节中的numberOfRowsInSection?CellforRowatinexPath甚至有人打电话吗?