分析我的应用程序,如果表格视图正确出列,我在“生活”中看到我的单元格 (PZCell) 的 25 个实例应该有 7 个左右。我的代码如下。
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView registerNib:[UINib nibWithNibName:@"PZCell" bundle:[NSBundle mainBundle]]
forCellReuseIdentifier:@"PZCell"];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.view.backgroundColor = [UIColor clearColor];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
PZCell *aCell = (PZCell *) [tableView dequeueReusableCellWithIdentifier:@"PZCell"];
[aCell setResult:[self.result.results objectAtIndex:[indexPath row]]];
return aCell;
}
在 nib 中设置重用标识符没有任何区别。任何帮助表示赞赏。干杯