Carregando uma subclasse UITableViewCell usando um arquivo XIB
Estou tendo problemas para conseguir meuCustomTableViewCell
, uma subclasse deUITableViewCell
para aparecer na minha visualização de tabela.
Eu estou usando um xib para representar essa célula, mas estou assumindo que o código para o delegado de fonte de dados não é alterado. Certifiquei-me de definir um identificador de reutilização idêntico dentro da célula de exibição de tabela XIB.
Eu isolei o problema para o fato de que o método da fonte de dados que retorna a célula da tabela não está funcionando corretamente, aqui está:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
CustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
DataObject *foo = [self.dataArray objectAtIndex:indexPath.row];
if (cell == nil)
{
cell = [[CustomTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
[[cell overview] setText:foo.overview];
[[cell price] setText:foo.price];
NSLog(@"cell initialized, description text is %@",cell.overview.text);
return cell;
}
Não sei por que isso não está funcionando, mas essa última instrução de log sempre imprime um (null) no final, e sim eu verifiquei se ooverview
propriedade do objeto de dados tem uma cadeia válida. Mesma coisa paraprice
.